summaryrefslogtreecommitdiff
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-12-05 01:43:42 +0100
committerVictor Stinner <victor.stinner@gmail.com>2014-12-05 01:43:42 +0100
commit4c85ec99f39bb6687f6fb0d23c6a7daedcde990e (patch)
tree73d12fd2c985da98134474feb1dffdff009e46e9 /Lib/asyncio
parente80bf0d4a996b3ecda2c2f3cbab10037b9fdcd5e (diff)
downloadcpython-git-4c85ec99f39bb6687f6fb0d23c6a7daedcde990e.tar.gz
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')
-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 a1e2fef6d1..4c527aa262 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