diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-05-16 15:38:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-16 15:38:16 (GMT) |
commit | 9ef5dcaa0b3c7c7ba28dbb3ec0c9507d9d05e3a9 (patch) | |
tree | 56b9b45660cc83960c2752e22ee47090632ebb09 /Python/coreconfig.c | |
parent | ae239f6b0626e926613a4a1dbafa323bd41fec32 (diff) | |
download | cpython-9ef5dcaa0b3c7c7ba28dbb3ec0c9507d9d05e3a9.zip cpython-9ef5dcaa0b3c7c7ba28dbb3ec0c9507d9d05e3a9.tar.gz cpython-9ef5dcaa0b3c7c7ba28dbb3ec0c9507d9d05e3a9.tar.bz2 |
bpo-36763: Add _Py_InitializeMain() (GH-13362)
* Add a private _Py_InitializeMain() function.
* Add again _PyCoreConfig._init_main.
* _Py_InitializeFromConfig() now uses _init_main to decide
if _Py_InitializeMainInterpreter() should be called.
* _PyCoreConfig: rename _frozen to pathconfig_warnings, its value is
now the opposite of Py_FrozenFlag.
* Add an unit test for _init_main=0 and _Py_InitializeMain().
Diffstat (limited to 'Python/coreconfig.c')
-rw-r--r-- | Python/coreconfig.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Python/coreconfig.c b/Python/coreconfig.c index 2b13c5f..8a5e5d5 100644 --- a/Python/coreconfig.c +++ b/Python/coreconfig.c @@ -667,7 +667,8 @@ _PyCoreConfig_Copy(_PyCoreConfig *config, const _PyCoreConfig *config2) COPY_WSTR_ATTR(run_module); COPY_WSTR_ATTR(run_filename); COPY_WSTR_ATTR(check_hash_pycs_mode); - COPY_ATTR(_frozen); + COPY_ATTR(pathconfig_warnings); + COPY_ATTR(_init_main); #undef COPY_ATTR #undef COPY_WSTR_ATTR @@ -766,7 +767,8 @@ _PyCoreConfig_AsDict(const _PyCoreConfig *config) SET_ITEM_WSTR(run_filename); SET_ITEM_INT(_install_importlib); SET_ITEM_WSTR(check_hash_pycs_mode); - SET_ITEM_INT(_frozen); + SET_ITEM_INT(pathconfig_warnings); + SET_ITEM_INT(_init_main); return dict; @@ -855,7 +857,7 @@ _PyCoreConfig_GetGlobalConfig(_PyCoreConfig *config) #ifdef MS_WINDOWS COPY_FLAG(legacy_windows_stdio, Py_LegacyWindowsStdioFlag); #endif - COPY_FLAG(_frozen, Py_FrozenFlag); + COPY_NOT_FLAG(pathconfig_warnings, Py_FrozenFlag); COPY_NOT_FLAG(buffered_stdio, Py_UnbufferedStdioFlag); COPY_NOT_FLAG(site_import, Py_NoSiteFlag); @@ -892,7 +894,7 @@ _PyCoreConfig_SetGlobalConfig(const _PyCoreConfig *config) #ifdef MS_WINDOWS COPY_FLAG(legacy_windows_stdio, Py_LegacyWindowsStdioFlag); #endif - COPY_FLAG(_frozen, Py_FrozenFlag); + COPY_NOT_FLAG(pathconfig_warnings, Py_FrozenFlag); COPY_NOT_FLAG(buffered_stdio, Py_UnbufferedStdioFlag); COPY_NOT_FLAG(site_import, Py_NoSiteFlag); @@ -2253,7 +2255,7 @@ _PyCoreConfig_Read(_PyCoreConfig *config) assert(!(config->run_command != NULL && config->run_module != NULL)); assert(config->check_hash_pycs_mode != NULL); assert(config->_install_importlib >= 0); - assert(config->_frozen >= 0); + assert(config->pathconfig_warnings >= 0); err = _Py_INIT_OK(); |