mirror of
https://github.com/python/cpython.git
synced 2025-09-13 12:17:24 +00:00
bpo-34008: Allow to call Py_Main() after Py_Initialize() (GH-8043)
Py_Main() can again be called after Py_Initialize(), as in Python 3.6. The new configuration is ignored, except of _PyMainInterpreterConfig.argv which is used to update sys.argv.
This commit is contained in:
parent
2c5c0a367c
commit
fb47bca9ee
5 changed files with 52 additions and 6 deletions
|
@ -2696,9 +2696,13 @@ pymain_main(_PyMain *pymain)
|
|||
|
||||
pymain_init_stdio(pymain);
|
||||
|
||||
pymain->err = _Py_InitializeCore(&pymain->config);
|
||||
if (_Py_INIT_FAILED(pymain->err)) {
|
||||
_Py_FatalInitError(pymain->err);
|
||||
/* bpo-34008: For backward compatibility reasons, calling Py_Main() after
|
||||
Py_Initialize() ignores the new configuration. */
|
||||
if (!_PyRuntime.initialized) {
|
||||
pymain->err = _Py_InitializeCore(&pymain->config);
|
||||
if (_Py_INIT_FAILED(pymain->err)) {
|
||||
_Py_FatalInitError(pymain->err);
|
||||
}
|
||||
}
|
||||
|
||||
if (pymain_init_python_main(pymain) < 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue