]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #22922: Fix ProactorEventLoop.close()
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 5 Dec 2014 00:43:42 +0000 (01:43 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 5 Dec 2014 00:43:42 +0000 (01:43 +0100)
Call _stop_accept_futures() before sestting the _closed attribute, otherwise
call_soon() raises an error.

Lib/asyncio/proactor_events.py

index a1e2fef6d17d5ada662aea9a0f0de3e25393476b..4c527aa262a5d2b2e372662467839af30c5193e9 100644 (file)
@@ -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