We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 23ef89d commit 29356e0Copy full SHA for 29356e0
Python/ceval_gil.h
@@ -281,13 +281,17 @@ take_gil(PyThreadState *tstate)
281
if (_Py_atomic_load_relaxed(&ceval->gil_drop_request)) {
282
RESET_GIL_DROP_REQUEST(ceval);
283
}
284
- if (tstate->async_exc != NULL) {
+
285
+ int must_exit = tstate_must_exit(tstate);
286
287
+ /* Don't access tstate if the thread must exit */
288
+ if (!must_exit && tstate->async_exc != NULL) {
289
_PyEval_SignalAsyncExc(ceval);
290
291
292
MUTEX_UNLOCK(gil->mutex);
293
- if (tstate_must_exit(tstate)) {
294
+ if (must_exit) {
295
/* bpo-36475: If Py_Finalize() has been called and tstate is not
296
the thread which called Py_Finalize(), exit immediately the
297
thread.
0 commit comments