summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-03-09 23:37:48 (GMT)
committerGitHub <noreply@github.com>2020-03-09 23:37:48 (GMT)
commit175a704abfcb3400aaeb66d4f098d92ca7e30892 (patch)
tree69632e4e77cf0a397bbe51cdc15d6f0624ef1cf9 /Python/ceval.c
parentaddaaaa946855ad59c8f5c698aa0891d7e44f018 (diff)
downloadcpython-175a704abfcb3400aaeb66d4f098d92ca7e30892.zip
cpython-175a704abfcb3400aaeb66d4f098d92ca7e30892.tar.gz
cpython-175a704abfcb3400aaeb66d4f098d92ca7e30892.tar.bz2
bpo-39877: PyGILState_Ensure() don't call PyEval_InitThreads() (GH-18891)
PyGILState_Ensure() doesn't call PyEval_InitThreads() anymore when a new Python thread state is created. The GIL is created by Py_Initialize() since Python 3.7, it's not needed to call PyEval_InitThreads() explicitly. Add an assertion to ensure that the GIL is already created.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 72a8304..0ee740a 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -199,10 +199,16 @@ ensure_tstate_not_null(const char *func, PyThreadState *tstate)
int
+_PyEval_ThreadsInitialized(_PyRuntimeState *runtime)
+{
+ return gil_created(&runtime->ceval.gil);
+}
+
+int
PyEval_ThreadsInitialized(void)
{
_PyRuntimeState *runtime = &_PyRuntime;
- return gil_created(&runtime->ceval.gil);
+ return _PyEval_ThreadsInitialized(runtime);
}
PyStatus