diff options
author | shadchin <shadchin@yandex-team.com> | 2024-06-20 22:38:00 +0300 |
---|---|---|
committer | shadchin <shadchin@yandex-team.com> | 2024-06-20 22:50:15 +0300 |
commit | 13d5ce08ec5a3ae159bbd7847337d0c52453093d (patch) | |
tree | 1a1023e1157d97b45b7782c545115375ec5776ae /library | |
parent | bf929c050a48627cfe6ab141b206a4f8a38672f6 (diff) | |
download | ydb-13d5ce08ec5a3ae159bbd7847337d0c52453093d.tar.gz |
Enable UTF-8 mode for all
0003a9ac951e380a13106a8f180014e0aed57f3a
Diffstat (limited to 'library')
-rw-r--r-- | library/python/runtime_py3/main/main.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/library/python/runtime_py3/main/main.c b/library/python/runtime_py3/main/main.c index 896ab0b21d..0c4aa23013 100644 --- a/library/python/runtime_py3/main/main.c +++ b/library/python/runtime_py3/main/main.c @@ -75,11 +75,26 @@ static int RunModule(const char* modname) } static int pymain(int argc, char** argv) { + PyStatus status; + if (IsYaIdeVenv()) { return Py_BytesMain(argc, argv); } - PyStatus status = _PyRuntime_Initialize(); + status = _PyRuntime_Initialize(); + if (PyStatus_Exception(status)) { + Py_ExitStatusException(status); + } + + PyPreConfig preconfig; + PyPreConfig_InitPythonConfig(&preconfig); + // Enable UTF-8 mode for all (DEVTOOLSSUPPORT-46624) + preconfig.utf8_mode = 1; +#ifdef MS_WINDOWS + preconfig.legacy_windows_fs_encoding = 0; +#endif + + status = Py_PreInitialize(&preconfig); if (PyStatus_Exception(status)) { Py_ExitStatusException(status); } |