summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-11-20 23:23:27 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-11-20 23:23:27 (GMT)
commit5e63120f8d1593700f8d5813c535d318c8bab111 (patch)
treee1856c36f08824b8d29a0578b07ee8c2a14de909 /Lib/asyncio
parent2d99d93d11e7908a51fde8de27b7a3584d23cf46 (diff)
downloadcpython-5e63120f8d1593700f8d5813c535d318c8bab111.zip
cpython-5e63120f8d1593700f8d5813c535d318c8bab111.tar.gz
cpython-5e63120f8d1593700f8d5813c535d318c8bab111.tar.bz2
asyncio: BaseSelectorEventLoop.close() now closes the self-pipe before calling
the parent close() method. If the event loop is already closed, the self-pipe is not unregistered from the selector.
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/selector_events.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
index 116d380..f0c94c4 100644
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -68,10 +68,12 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop):
address, waiter, extra)
def close(self):
+ if self._running:
+ raise RuntimeError("Cannot close a running event loop")
if self.is_closed():
return
- super().close()
self._close_self_pipe()
+ super().close()
if self._selector is not None:
self._selector.close()
self._selector = None