mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
Close #19576: PyGILState_Ensure() now initializes threads. At startup, Python
has no concrete GIL. If PyGILState_Ensure() is called from a new thread for the first time and PyEval_InitThreads() was not called yet, a GIL needs to be created.
This commit is contained in:
parent
56668dc187
commit
62ca10051b
2 changed files with 10 additions and 0 deletions
|
|
@ -10,6 +10,11 @@ Release date: 2014-01-05
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #19576: PyGILState_Ensure() now initializes threads. At startup, Python
|
||||||
|
has no concrete GIL. If PyGILState_Ensure() is called from a new thread for
|
||||||
|
the first time and PyEval_InitThreads() was not called yet, a GIL needs to be
|
||||||
|
created.
|
||||||
|
|
||||||
- Issue #17576: Deprecation warning emitted now when __int__() or __index__()
|
- Issue #17576: Deprecation warning emitted now when __int__() or __index__()
|
||||||
return not int instance.
|
return not int instance.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -771,6 +771,11 @@ PyGILState_Ensure(void)
|
||||||
assert(autoInterpreterState); /* Py_Initialize() hasn't been called! */
|
assert(autoInterpreterState); /* Py_Initialize() hasn't been called! */
|
||||||
tcur = (PyThreadState *)PyThread_get_key_value(autoTLSkey);
|
tcur = (PyThreadState *)PyThread_get_key_value(autoTLSkey);
|
||||||
if (tcur == NULL) {
|
if (tcur == NULL) {
|
||||||
|
/* At startup, Python has no concrete GIL. If PyGILState_Ensure() is
|
||||||
|
called from a new thread for the first time, we need the create the
|
||||||
|
GIL. */
|
||||||
|
PyEval_InitThreads();
|
||||||
|
|
||||||
/* Create a new thread state for this thread */
|
/* Create a new thread state for this thread */
|
||||||
tcur = PyThreadState_New(autoInterpreterState);
|
tcur = PyThreadState_New(autoInterpreterState);
|
||||||
if (tcur == NULL)
|
if (tcur == NULL)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue