Skip to content

Commit 152e2a2

Browse files
committed
Use PyGILState_EnsureOrFail() in _testcapi
1 parent 7256fa3 commit 152e2a2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Modules/_testcapimodule.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,9 @@ temporary_c_thread(void *data)
12751275
PyThread_release_lock(test_c_thread->start_event);
12761276

12771277
/* Allocate a Python thread state for this thread */
1278-
state = PyGILState_Ensure();
1278+
if (PyGILState_EnsureOrFail(&state) < 0) {
1279+
abort();
1280+
}
12791281

12801282
res = PyObject_CallNoArgs(test_c_thread->callback);
12811283
Py_CLEAR(test_c_thread->callback);

0 commit comments

Comments
 (0)