|
4 | 4 |
|
5 | 5 | #include "Python-ast.h" |
6 | 6 | #undef Yield /* undefine macro conflicting with <winbase.h> */ |
7 | | -#include "pycore_ceval.h" /* _PyEval_FiniThreads() */ |
8 | | -#include "pycore_context.h" |
9 | 7 | #include "pycore_coreconfig.h" |
| 8 | +#include "pycore_context.h" |
10 | 9 | #include "pycore_fileutils.h" |
11 | 10 | #include "pycore_hamt.h" |
12 | 11 | #include "pycore_pathconfig.h" |
@@ -556,11 +555,12 @@ pycore_create_interpreter(_PyRuntimeState *runtime, |
556 | 555 | return _Py_INIT_ERR("can't make first thread"); |
557 | 556 | (void) PyThreadState_Swap(tstate); |
558 | 557 |
|
559 | | - /* Destroying the GIL in Py_FinalizeEx might fail when it is being |
560 | | - referenced from another running thread (see bpo-9901). |
| 558 | + /* We can't call _PyEval_FiniThreads() in Py_FinalizeEx because |
| 559 | + destroying the GIL might fail when it is being referenced from |
| 560 | + another running thread (see issue #9901). |
561 | 561 | Instead we destroy the previously created GIL here, which ensures |
562 | 562 | that we can call Py_Initialize / Py_FinalizeEx multiple times. */ |
563 | | - _PyEval_FiniThreads2(); |
| 563 | + _PyEval_FiniThreads(); |
564 | 564 |
|
565 | 565 | /* Auto-thread-state API */ |
566 | 566 | _PyGILState_Init(runtime, interp, tstate); |
@@ -1357,7 +1357,6 @@ Py_FinalizeEx(void) |
1357 | 1357 |
|
1358 | 1358 | call_ll_exitfuncs(runtime); |
1359 | 1359 |
|
1360 | | - _PyEval_FiniThreads(); |
1361 | 1360 | _PyRuntime_Finalize(); |
1362 | 1361 | return status; |
1363 | 1362 | } |
|
0 commit comments