diff options
author | kikht <kikht@yandex-team.ru> | 2022-02-10 16:45:14 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:14 +0300 |
commit | 194cae0e8855b11be2005e1eff12c660c3ee9774 (patch) | |
tree | ed29c437b616690880c017855ebe0be34fdf81a2 /library/python/runtime_py3 | |
parent | 49116032d905455a7b1c994e4a696afc885c1e71 (diff) | |
download | ydb-194cae0e8855b11be2005e1eff12c660c3ee9774.tar.gz |
Restoring authorship annotation for <kikht@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/python/runtime_py3')
-rw-r--r-- | library/python/runtime_py3/main/get_py_main.cpp | 16 | ||||
-rw-r--r-- | library/python/runtime_py3/main/main.c | 40 | ||||
-rw-r--r-- | library/python/runtime_py3/main/ya.make | 4 |
3 files changed, 30 insertions, 30 deletions
diff --git a/library/python/runtime_py3/main/get_py_main.cpp b/library/python/runtime_py3/main/get_py_main.cpp index 67c400d4f4..38e0b3a32d 100644 --- a/library/python/runtime_py3/main/get_py_main.cpp +++ b/library/python/runtime_py3/main/get_py_main.cpp @@ -1,8 +1,8 @@ -#include <library/cpp/resource/resource.h> - -#include <stdlib.h> - -extern "C" char* GetPyMain() { - TString res = NResource::Find("PY_MAIN"); - return strdup(res.c_str()); -} +#include <library/cpp/resource/resource.h> + +#include <stdlib.h> + +extern "C" char* GetPyMain() { + TString res = NResource::Find("PY_MAIN"); + return strdup(res.c_str()); +} diff --git a/library/python/runtime_py3/main/main.c b/library/python/runtime_py3/main/main.c index 3159800615..70983343c9 100644 --- a/library/python/runtime_py3/main/main.c +++ b/library/python/runtime_py3/main/main.c @@ -6,7 +6,7 @@ #include <locale.h> void Py_InitArgcArgv(int argc, wchar_t **argv); -char* GetPyMain(); +char* GetPyMain(); static const char* env_entry_point = "Y_PYTHON_ENTRY_POINT"; static const char* env_bytes_warning = "Y_PYTHON_BYTES_WARNING"; @@ -135,26 +135,26 @@ static int pymain(int argc, char** argv) { } const char* entry_point = getenv(env_entry_point); - if (entry_point) { - entry_point_copy = strdup(entry_point); - if (!entry_point_copy) { - fprintf(stderr, "out of memory\n"); - goto error; - } - } else { - entry_point_copy = GetPyMain(); - } - - if (entry_point_copy == NULL) { - fprintf(stderr, "No entry point, did you forget PY_MAIN?\n"); - goto error; - } - - if (entry_point_copy && !strcmp(entry_point_copy, ":main")) { + if (entry_point) { + entry_point_copy = strdup(entry_point); + if (!entry_point_copy) { + fprintf(stderr, "out of memory\n"); + goto error; + } + } else { + entry_point_copy = GetPyMain(); + } + + if (entry_point_copy == NULL) { + fprintf(stderr, "No entry point, did you forget PY_MAIN?\n"); + goto error; + } + + if (entry_point_copy && !strcmp(entry_point_copy, ":main")) { unsetenv(env_entry_point); - sts = Py_Main(argc, argv_copy); - free(entry_point_copy); - return sts; + sts = Py_Main(argc, argv_copy); + free(entry_point_copy); + return sts; } Py_InitArgcArgv(argc, argv_copy); diff --git a/library/python/runtime_py3/main/ya.make b/library/python/runtime_py3/main/ya.make index f308a93b28..ff0dd1d27f 100644 --- a/library/python/runtime_py3/main/ya.make +++ b/library/python/runtime_py3/main/ya.make @@ -7,7 +7,7 @@ OWNER( PEERDIR( contrib/tools/python3/src - library/cpp/resource + library/cpp/resource ) ADDINCL( @@ -20,7 +20,7 @@ CFLAGS( SRCS( main.c - get_py_main.cpp + get_py_main.cpp ) END() |