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.
This commit is contained in:
Victor Stinner 2014-11-21 00:23:27 +01:00
parent 2d99d93d11
commit 5e63120f8d
1 changed files with 3 additions and 1 deletions

View File

@ -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