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/main/main.c | |
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/main/main.c')
-rw-r--r-- | library/python/runtime_py3/main/main.c | 40 |
1 files changed, 20 insertions, 20 deletions
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); |