diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-04-29 09:15:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-29 09:15:56 (GMT) |
commit | b36e5d627d4232a01850707eb78a5067f3fd77f4 (patch) | |
tree | 63eb8a0966e7ac1b721f8de5c877d4bc79c6fa58 /Modules | |
parent | 7a5a1cfe04892351bba8e8d7d21ae2262fa35b67 (diff) | |
download | cpython-b36e5d627d4232a01850707eb78a5067f3fd77f4.zip cpython-b36e5d627d4232a01850707eb78a5067f3fd77f4.tar.gz cpython-b36e5d627d4232a01850707eb78a5067f3fd77f4.tar.bz2 |
bpo-36356: Destroy the GIL at exit (GH-12453)
* Add _PyEval_FiniThreads2(). _PyEval_FiniThreads() now only clears
the pending lock, whereas _PyEval_FiniThreads2() destroys the GIL.
* pymain_free() now calls _PyEval_FiniThreads2().
* Py_FinalizeEx() now calls _PyEval_FiniThreads().
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/main.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Modules/main.c b/Modules/main.c index 68f0b99..f77bbd2 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -1,6 +1,7 @@ /* Python interpreter main program */ #include "Python.h" +#include "pycore_ceval.h" /* _PyEval_FiniThreads2() */ #include "pycore_coreconfig.h" #include "pycore_pylifecycle.h" #include "pycore_pymem.h" @@ -525,15 +526,15 @@ done: /* --- pymain_main() ---------------------------------------------- */ +/* Free global variables which cannot be freed in Py_Finalize(): + configuration options set before Py_Initialize() which should + remain valid after Py_Finalize(), since + Py_Initialize()-Py_Finalize() can be called multiple times. */ static void pymain_free(void) { _PyImport_Fini2(); - - /* Free global variables which cannot be freed in Py_Finalize(): - configuration options set before Py_Initialize() which should - remain valid after Py_Finalize(), since - Py_Initialize()-Py_Finalize() can be called multiple times. */ + _PyEval_FiniThreads2(); _PyPathConfig_ClearGlobal(); _Py_ClearStandardStreamEncoding(); _Py_ClearArgcArgv(); |