summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/proactor_events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-12-05 00:43:42 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-12-05 00:43:42 (GMT)
commit4c85ec99f39bb6687f6fb0d23c6a7daedcde990e (patch)
tree73d12fd2c985da98134474feb1dffdff009e46e9 /Lib/asyncio/proactor_events.py
parente80bf0d4a996b3ecda2c2f3cbab10037b9fdcd5e (diff)
downloadcpython-4c85ec99f39bb6687f6fb0d23c6a7daedcde990e.zip
cpython-4c85ec99f39bb6687f6fb0d23c6a7daedcde990e.tar.gz
cpython-4c85ec99f39bb6687f6fb0d23c6a7daedcde990e.tar.bz2
Issue #22922: Fix ProactorEventLoop.close()
Call _stop_accept_futures() before sestting the _closed attribute, otherwise call_soon() raises an error.
Diffstat (limited to 'Lib/asyncio/proactor_events.py')
-rw-r--r--Lib/asyncio/proactor_events.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index a1e2fef..4c527aa 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -387,11 +387,13 @@ class BaseProactorEventLoop(base_events.BaseEventLoop):
sock, protocol, waiter, extra)
def close(self):
+ if self._running:
+ raise RuntimeError("Cannot close a running event loop")
if self.is_closed():
return
- super().close()
self._stop_accept_futures()
self._close_self_pipe()
+ super().close()
self._proactor.close()
self._proactor = None
self._selector = None