summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/utils.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-09-19 14:45:06 (GMT)
committerGitHub <noreply@github.com>2019-09-19 14:45:06 (GMT)
commit079931d12223ec98cbf53185b90db48efa61f93f (patch)
treed01265076e2209ca1404644075b491172343f705 /Lib/test/test_asyncio/utils.py
parentb2dd2dd6e9212ba6b03885b998736a180ef283d6 (diff)
downloadcpython-079931d12223ec98cbf53185b90db48efa61f93f.zip
cpython-079931d12223ec98cbf53185b90db48efa61f93f.tar.gz
cpython-079931d12223ec98cbf53185b90db48efa61f93f.tar.bz2
bpo-34037: test_asyncio uses shutdown_default_executor() (GH-16284)
Diffstat (limited to 'Lib/test/test_asyncio/utils.py')
-rw-r--r--Lib/test/test_asyncio/utils.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py
index 5b4bb12..ea608f4 100644
--- a/Lib/test/test_asyncio/utils.py
+++ b/Lib/test/test_asyncio/utils.py
@@ -509,9 +509,11 @@ def get_function_source(func):
class TestCase(unittest.TestCase):
@staticmethod
def close_loop(loop):
- executor = loop._default_executor
- if executor is not None:
- executor.shutdown(wait=True)
+ if loop._default_executor is not None:
+ if not loop.is_closed():
+ loop.run_until_complete(loop.shutdown_default_executor())
+ else:
+ loop._default_executor.shutdown(wait=True)
loop.close()
policy = support.maybe_get_event_loop_policy()
if policy is not None: