diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-12-05 00:43:42 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-12-05 00:43:42 (GMT) |
commit | 4c85ec99f39bb6687f6fb0d23c6a7daedcde990e (patch) | |
tree | 73d12fd2c985da98134474feb1dffdff009e46e9 /Lib/asyncio/proactor_events.py | |
parent | e80bf0d4a996b3ecda2c2f3cbab10037b9fdcd5e (diff) | |
download | cpython-4c85ec99f39bb6687f6fb0d23c6a7daedcde990e.zip cpython-4c85ec99f39bb6687f6fb0d23c6a7daedcde990e.tar.gz cpython-4c85ec99f39bb6687f6fb0d23c6a7daedcde990e.tar.bz2 |
Issue #22922: Fix ProactorEventLoop.close()
Call _stop_accept_futures() before sestting the _closed attribute, otherwise
call_soon() raises an error.
Diffstat (limited to 'Lib/asyncio/proactor_events.py')
-rw-r--r-- | Lib/asyncio/proactor_events.py | 4 |
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 |