mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
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:
parent
2d99d93d11
commit
5e63120f8d
1 changed files with 3 additions and 1 deletions
|
|
@ -68,10 +68,12 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop):
|
||||||
address, waiter, extra)
|
address, waiter, extra)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
if self._running:
|
||||||
|
raise RuntimeError("Cannot close a running event loop")
|
||||||
if self.is_closed():
|
if self.is_closed():
|
||||||
return
|
return
|
||||||
super().close()
|
|
||||||
self._close_self_pipe()
|
self._close_self_pipe()
|
||||||
|
super().close()
|
||||||
if self._selector is not None:
|
if self._selector is not None:
|
||||||
self._selector.close()
|
self._selector.close()
|
||||||
self._selector = None
|
self._selector = None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue