Skip to content

Commit

Permalink
Issue python#22922: Fix ProactorEventLoop.close()
Browse files Browse the repository at this point in the history
Call _stop_accept_futures() before sestting the _closed attribute, otherwise
call_soon() raises an error.
  • Loading branch information
vstinner committed Dec 5, 2014
1 parent e80bf0d commit 4c85ec9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Lib/asyncio/proactor_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,13 @@ def _make_write_pipe_transport(self, sock, protocol, waiter=None,
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
Expand Down

0 comments on commit 4c85ec9

Please sign in to comment.