From fdccfe09f0b10776645fdb04a0783d6864c32b21 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Mon, 28 May 2018 17:10:20 -0400 Subject: bpo-33469: RuntimeError after closing loop that used run_in_executor (GH-7171) --- Lib/asyncio/futures.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Lib/asyncio/futures.py') diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py index 4a56f32c77..0e0e696a25 100644 --- a/Lib/asyncio/futures.py +++ b/Lib/asyncio/futures.py @@ -353,6 +353,9 @@ def _chain_future(source, destination): source_loop.call_soon_threadsafe(source.cancel) def _call_set_state(source): + if (destination.cancelled() and + dest_loop is not None and dest_loop.is_closed()): + return if dest_loop is None or dest_loop is source_loop: _set_state(destination, source) else: -- cgit v1.2.1