mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
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().
This commit is contained in:
parent
7a5a1cfe04
commit
b36e5d627d
5 changed files with 26 additions and 18 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue