summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-12-05 00:25:21 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-12-05 00:25:21 (GMT)
commitba7c1815133f4967f84ccadf891ff074cf8d03f4 (patch)
tree69b2d797482395eca471673535f60937837cc2a2
parentd5ea5d528a5bd356b1204ba8ac2bb9d27be0ac02 (diff)
downloadcpython-ba7c1815133f4967f84ccadf891ff074cf8d03f4.zip
cpython-ba7c1815133f4967f84ccadf891ff074cf8d03f4.tar.gz
cpython-ba7c1815133f4967f84ccadf891ff074cf8d03f4.tar.bz2
Issue #22922: Fix ProactorEventLoop.close()
Call _stop_accept_futures() before sestting the _closed attribute, otherwise call_soon() raises an error.
-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