summaryrefslogtreecommitdiffstats
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-06-22 17:14:51 (GMT)
committerGitHub <noreply@github.com>2018-06-22 17:14:51 (GMT)
commit209abf746985526bce255e2fba97d3246924885d (patch)
tree4eaedaa7a870d61c2805df599e21fb9c883ddaeb /Python/pylifecycle.c
parentbcd3a1a18d841338f57c39f6a7de8cf14d0c3e03 (diff)
downloadcpython-209abf746985526bce255e2fba97d3246924885d.zip
cpython-209abf746985526bce255e2fba97d3246924885d.tar.gz
cpython-209abf746985526bce255e2fba97d3246924885d.tar.bz2
bpo-33932: Calling Py_Initialize() twice does nothing (GH-7845)
Calling Py_Initialize() twice does nothing, instead of failing with a fatal error: restore the Python 3.6 behaviour.
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 958219b..9bf0ebd 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -892,6 +892,11 @@ _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *config)
_PyInitError
_Py_InitializeEx_Private(int install_sigs, int install_importlib)
{
+ if (_PyRuntime.initialized) {
+ /* bpo-33932: Calling Py_Initialize() twice does nothing. */
+ return _Py_INIT_OK();
+ }
+
_PyCoreConfig config = _PyCoreConfig_INIT;
_PyInitError err;