summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/futures.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2022-09-30 19:55:40 (GMT)
committerGitHub <noreply@github.com>2022-09-30 19:55:40 (GMT)
commite9d63760fea8748638f6e495b5b07bd1805c9591 (patch)
tree26a42e0867b0a7cdc67b39e4f1b44021d95ef36f /Lib/asyncio/futures.py
parentb05dd796492160c37c9e15e3882f699f411b3461 (diff)
downloadcpython-e9d63760fea8748638f6e495b5b07bd1805c9591.zip
cpython-e9d63760fea8748638f6e495b5b07bd1805c9591.tar.gz
cpython-e9d63760fea8748638f6e495b5b07bd1805c9591.tar.bz2
GH-96827: Don't touch closed loops from executor threads (#96837)
* When chaining futures, skip callback if loop closed. * When shutting down an executor, don't wake a closed loop.
Diffstat (limited to 'Lib/asyncio/futures.py')
-rw-r--r--Lib/asyncio/futures.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py
index 4bd9629..39776e3 100644
--- a/Lib/asyncio/futures.py
+++ b/Lib/asyncio/futures.py
@@ -404,6 +404,8 @@ def _chain_future(source, destination):
if dest_loop is None or dest_loop is source_loop:
_set_state(destination, source)
else:
+ if dest_loop.is_closed():
+ return
dest_loop.call_soon_threadsafe(_set_state, destination, source)
destination.add_done_callback(_call_check_cancel)