mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #22922: Fix ProactorEventLoop.close()
Call _stop_accept_futures() before sestting the _closed attribute, otherwise call_soon() raises an error.
This commit is contained in:
parent
e80bf0d4a9
commit
4c85ec99f3
1 changed files with 3 additions and 1 deletions
|
@ -387,11 +387,13 @@ class BaseProactorEventLoop(base_events.BaseEventLoop):
|
||||||
sock, protocol, waiter, extra)
|
sock, protocol, 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._stop_accept_futures()
|
self._stop_accept_futures()
|
||||||
self._close_self_pipe()
|
self._close_self_pipe()
|
||||||
|
super().close()
|
||||||
self._proactor.close()
|
self._proactor.close()
|
||||||
self._proactor = None
|
self._proactor = None
|
||||||
self._selector = None
|
self._selector = None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue