mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
bpo-36763: _PyCoreConfig_SetPyArgv() preinitializes Python (GH-13037)
_PyCoreConfig_SetPyArgv() and _PyCoreConfig_SetWideString() now pre-initialize Python if needed to ensure that the locale encoding is properly configured. * Add _Py_PreInitializeFromPyArgv() internal function. * Add 'args' parameter to _Py_PreInitializeFromCoreConfig()
This commit is contained in:
parent
709d23dee6
commit
70005ac0fd
4 changed files with 50 additions and 27 deletions
|
@ -57,14 +57,7 @@ pymain_init(const _PyArgv *args)
|
|||
environment variables (PYTHONUTF8 and PYTHONCOERCECLOCALE) */
|
||||
preconfig.coerce_c_locale = -1;
|
||||
preconfig.utf8_mode = -1;
|
||||
if (args->use_bytes_argv) {
|
||||
err = _Py_PreInitializeFromArgs(&preconfig,
|
||||
args->argc, args->bytes_argv);
|
||||
}
|
||||
else {
|
||||
err = _Py_PreInitializeFromWideArgs(&preconfig,
|
||||
args->argc, args->wchar_argv);
|
||||
}
|
||||
err = _Py_PreInitializeFromPyArgv(&preconfig, args);
|
||||
if (_Py_INIT_FAILED(err)) {
|
||||
return err;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue