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 74f6568 commit 4000dcdCopy full SHA for 4000dcd
Python/ceval.c
@@ -365,6 +365,17 @@ _pop_pending_call(int (**func)(void *), void **arg)
365
int
366
Py_AddPendingCall(int (*func)(void *), void *arg)
367
{
368
+ if (_PyRuntime.finalizing) {
369
+ PyObject *exc, *val, *tb;
370
+ PyErr_Fetch(&exc, &val, &tb);
371
+ PyErr_SetString(PyExc_SystemError,
372
+ "Py_AddPendingCall: cannot add pending calls "
373
+ "(Python shutting down)");
374
+ PyErr_Print();
375
+ PyErr_Restore(exc, val, tb);
376
+ return -1;
377
+ }
378
+
379
PyThread_acquire_lock(_PyRuntime.ceval.pending.lock, WAIT_LOCK);
380
int result = _push_pending_call(func, arg);
381
PyThread_release_lock(_PyRuntime.ceval.pending.lock);
0 commit comments