diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /library/python/runtime_py3/main | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/python/runtime_py3/main')
-rw-r--r-- | library/python/runtime_py3/main/main.c | 52 | ||||
-rw-r--r-- | library/python/runtime_py3/main/ya.make | 8 |
2 files changed, 30 insertions, 30 deletions
diff --git a/library/python/runtime_py3/main/main.c b/library/python/runtime_py3/main/main.c index 939c290827..3159800615 100644 --- a/library/python/runtime_py3/main/main.c +++ b/library/python/runtime_py3/main/main.c @@ -1,5 +1,5 @@ #include <Python.h> -#include <contrib/tools/python3/src/Include/internal/pycore_runtime.h> // _PyRuntime_Initialize() +#include <contrib/tools/python3/src/Include/internal/pycore_runtime.h> // _PyRuntime_Initialize() #include <stdlib.h> #include <string.h> @@ -9,7 +9,7 @@ void Py_InitArgcArgv(int argc, wchar_t **argv); char* GetPyMain(); static const char* env_entry_point = "Y_PYTHON_ENTRY_POINT"; -static const char* env_bytes_warning = "Y_PYTHON_BYTES_WARNING"; +static const char* env_bytes_warning = "Y_PYTHON_BYTES_WARNING"; #ifdef _MSC_VER extern char** environ; @@ -74,11 +74,11 @@ static int RunModule(const char *modname) } static int pymain(int argc, char** argv) { - PyStatus status = _PyRuntime_Initialize(); - if (PyStatus_Exception(status)) { - Py_ExitStatusException(status); - } - + PyStatus status = _PyRuntime_Initialize(); + if (PyStatus_Exception(status)) { + Py_ExitStatusException(status); + } + int i, sts = 1; char* oldloc = NULL; wchar_t** argv_copy = NULL; @@ -95,15 +95,15 @@ static int pymain(int argc, char** argv) { } } - PyConfig config; - PyConfig_InitPythonConfig(&config); - config.pathconfig_warnings = 0; /* Suppress errors from getpath.c */ - - const char* bytes_warning = getenv(env_bytes_warning); - if (bytes_warning) { - config.bytes_warning = atoi(bytes_warning); - } - + PyConfig config; + PyConfig_InitPythonConfig(&config); + config.pathconfig_warnings = 0; /* Suppress errors from getpath.c */ + + const char* bytes_warning = getenv(env_bytes_warning); + if (bytes_warning) { + config.bytes_warning = atoi(bytes_warning); + } + oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL)); if (!oldloc) { fprintf(stderr, "out of memory\n"); @@ -116,7 +116,7 @@ static int pymain(int argc, char** argv) { argv_copy2[i] = argv_copy[i]; if (!argv_copy[i]) { fprintf(stderr, "Unable to decode the command line argument #%i\n", - i + 1); + i + 1); argc = i; goto error; } @@ -125,15 +125,15 @@ static int pymain(int argc, char** argv) { PyMem_RawFree(oldloc); oldloc = NULL; - if (argc >= 1) - Py_SetProgramName(argv_copy[0]); - - status = Py_InitializeFromConfig(&config); - PyConfig_Clear(&config); - if (PyStatus_Exception(status)) { - Py_ExitStatusException(status); - } - + if (argc >= 1) + Py_SetProgramName(argv_copy[0]); + + status = Py_InitializeFromConfig(&config); + PyConfig_Clear(&config); + if (PyStatus_Exception(status)) { + Py_ExitStatusException(status); + } + const char* entry_point = getenv(env_entry_point); if (entry_point) { entry_point_copy = strdup(entry_point); diff --git a/library/python/runtime_py3/main/ya.make b/library/python/runtime_py3/main/ya.make index 30a96c8728..f308a93b28 100644 --- a/library/python/runtime_py3/main/ya.make +++ b/library/python/runtime_py3/main/ya.make @@ -14,10 +14,10 @@ ADDINCL( contrib/tools/python3/src/Include ) -CFLAGS( - -DPy_BUILD_CORE -) - +CFLAGS( + -DPy_BUILD_CORE +) + SRCS( main.c get_py_main.cpp |