diff options
-rw-r--r-- | Lib/asyncio/selector_events.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index 116d380..f0c94c4 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -68,10 +68,12 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop): address, waiter, extra) def close(self): + if self._running: + raise RuntimeError("Cannot close a running event loop") if self.is_closed(): return - super().close() self._close_self_pipe() + super().close() if self._selector is not None: self._selector.close() self._selector = None |