summaryrefslogtreecommitdiffstats
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-04-29 11:04:07 (GMT)
committerGitHub <noreply@github.com>2019-04-29 11:04:07 (GMT)
commit99fcc616d400cd31af0733c3f8cc93bcc1d32a44 (patch)
tree0081a47a3cae0a556affff285079a9361c5b8c45 /Python/pylifecycle.c
parentb36e5d627d4232a01850707eb78a5067f3fd77f4 (diff)
downloadcpython-99fcc616d400cd31af0733c3f8cc93bcc1d32a44.zip
cpython-99fcc616d400cd31af0733c3f8cc93bcc1d32a44.tar.gz
cpython-99fcc616d400cd31af0733c3f8cc93bcc1d32a44.tar.bz2
Revert "bpo-36356: Destroy the GIL at exit (GH-12453)" (GH613006)
This reverts commit b36e5d627d4232a01850707eb78a5067f3fd77f4.
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 0836e18..d93fe06 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -4,9 +4,8 @@
#include "Python-ast.h"
#undef Yield /* undefine macro conflicting with <winbase.h> */
-#include "pycore_ceval.h" /* _PyEval_FiniThreads() */
-#include "pycore_context.h"
#include "pycore_coreconfig.h"
+#include "pycore_context.h"
#include "pycore_fileutils.h"
#include "pycore_hamt.h"
#include "pycore_pathconfig.h"
@@ -556,11 +555,12 @@ pycore_create_interpreter(_PyRuntimeState *runtime,
return _Py_INIT_ERR("can't make first thread");
(void) PyThreadState_Swap(tstate);
- /* Destroying the GIL in Py_FinalizeEx might fail when it is being
- referenced from another running thread (see bpo-9901).
+ /* We can't call _PyEval_FiniThreads() in Py_FinalizeEx because
+ destroying the GIL might fail when it is being referenced from
+ another running thread (see issue #9901).
Instead we destroy the previously created GIL here, which ensures
that we can call Py_Initialize / Py_FinalizeEx multiple times. */
- _PyEval_FiniThreads2();
+ _PyEval_FiniThreads();
/* Auto-thread-state API */
_PyGILState_Init(runtime, interp, tstate);
@@ -1357,7 +1357,6 @@ Py_FinalizeEx(void)
call_ll_exitfuncs(runtime);
- _PyEval_FiniThreads();
_PyRuntime_Finalize();
return status;
}