mirror of
https://github.com/python/cpython.git
synced 2025-07-12 22:05:16 +00:00
bpo-20891: Py_Initialize() now creates the GIL (#4700)
The GIL is no longer created "on demand" to fix a race condition when PyGILState_Ensure() is called in a non-Python thread.
This commit is contained in:
parent
8997f9cd1a
commit
2914bb32e2
4 changed files with 43 additions and 52 deletions
|
@ -681,9 +681,13 @@ _Py_InitializeCore(const _PyCoreConfig *core_config)
|
|||
Instead we destroy the previously created GIL here, which ensures
|
||||
that we can call Py_Initialize / Py_FinalizeEx multiple times. */
|
||||
_PyEval_FiniThreads();
|
||||
|
||||
/* Auto-thread-state API */
|
||||
_PyGILState_Init(interp, tstate);
|
||||
|
||||
/* Create the GIL */
|
||||
PyEval_InitThreads();
|
||||
|
||||
_Py_ReadyTypes();
|
||||
|
||||
if (!_PyFrame_Init())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue