diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-06-13 21:02:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-13 21:02:19 (GMT) |
commit | 757b402ea1c2c6b925a55a08fd844b065b6e082f (patch) | |
tree | cf4f2ea1aff52a2c7faa7181f3f9af01f732830f /Modules/_queuemodule.c | |
parent | 4e80082723b768df124f77d2b73b3ba6b584a735 (diff) | |
download | cpython-757b402ea1c2c6b925a55a08fd844b065b6e082f.zip cpython-757b402ea1c2c6b925a55a08fd844b065b6e082f.tar.gz cpython-757b402ea1c2c6b925a55a08fd844b065b6e082f.tar.bz2 |
gh-104812: Run Pending Calls in any Thread (gh-104813)
For a while now, pending calls only run in the main thread (in the main interpreter). This PR changes things to allow any thread run a pending call, unless the pending call was explicitly added for the main thread to run.
Diffstat (limited to 'Modules/_queuemodule.c')
-rw-r--r-- | Modules/_queuemodule.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/_queuemodule.c b/Modules/_queuemodule.c index d36a911..db5be84 100644 --- a/Modules/_queuemodule.c +++ b/Modules/_queuemodule.c @@ -210,6 +210,7 @@ _queue_SimpleQueue_get_impl(simplequeueobject *self, PyTypeObject *cls, PyObject *item; PyLockStatus r; PY_TIMEOUT_T microseconds; + PyThreadState *tstate = PyThreadState_Get(); if (block == 0) { /* Non-blocking */ @@ -253,7 +254,7 @@ _queue_SimpleQueue_get_impl(simplequeueobject *self, PyTypeObject *cls, Py_END_ALLOW_THREADS } - if (r == PY_LOCK_INTR && Py_MakePendingCalls() < 0) { + if (r == PY_LOCK_INTR && _PyEval_MakePendingCalls(tstate) < 0) { return NULL; } if (r == PY_LOCK_FAILURE) { |