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 /Include/cpython | |
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 'Include/cpython')
-rw-r--r-- | Include/cpython/coreconfig.h | 13 | ||||
-rw-r--r-- | Include/cpython/pylifecycle.h | 1 |
2 files changed, 10 insertions, 4 deletions
diff --git a/Include/cpython/coreconfig.h b/Include/cpython/coreconfig.h index a04342e..c2c5566 100644 --- a/Include/cpython/coreconfig.h +++ b/Include/cpython/coreconfig.h @@ -398,10 +398,14 @@ typedef struct { See PEP 552 "Deterministic pycs" for more details. */ wchar_t *check_hash_pycs_mode; - /* If greater than 0, suppress _PyPathConfig_Calculate() warnings. + /* If greater than 0, suppress _PyPathConfig_Calculate() warnings on Unix. + The parameter has no effect on Windows. - If set to -1 (default), inherit Py_FrozenFlag value. */ - int _frozen; + If set to -1 (default), inherit !Py_FrozenFlag value. */ + int pathconfig_warnings; + + /* If equal to 0, stop Python initialization before the "main" phase */ + int _init_main; } _PyCoreConfig; @@ -438,7 +442,8 @@ typedef struct { .buffered_stdio = -1, \ ._install_importlib = 1, \ .check_hash_pycs_mode = NULL, \ - ._frozen = -1} + .pathconfig_warnings = -1, \ + ._init_main = 1} /* Note: _PyCoreConfig_INIT sets other fields to 0/NULL */ #ifdef __cplusplus diff --git a/Include/cpython/pylifecycle.h b/Include/cpython/pylifecycle.h index 2366c77..a3ab6c9 100644 --- a/Include/cpython/pylifecycle.h +++ b/Include/cpython/pylifecycle.h @@ -40,6 +40,7 @@ PyAPI_FUNC(_PyInitError) _Py_InitializeFromWideArgs( const _PyCoreConfig *config, int argc, wchar_t **argv); +PyAPI_FUNC(_PyInitError) _Py_InitializeMain(void); PyAPI_FUNC(int) _Py_RunMain(void); |