diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-10-19 22:54:10 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-10-19 22:54:10 (GMT) |
commit | 4ca7355901049ff9a873cf236091e6780d7a8126 (patch) | |
tree | 27009b2d9683843b1bb89062a2cef914f95044f5 /Lib/asyncio | |
parent | 34d33a595b2e8f0736e5f05b43ddcbabb57b72be (diff) | |
download | cpython-4ca7355901049ff9a873cf236091e6780d7a8126.zip cpython-4ca7355901049ff9a873cf236091e6780d7a8126.tar.gz cpython-4ca7355901049ff9a873cf236091e6780d7a8126.tar.bz2 |
Issue #19299: fix refleak test failures in test_asyncio
Diffstat (limited to 'Lib/asyncio')
-rw-r--r-- | Lib/asyncio/base_events.py | 8 | ||||
-rw-r--r-- | Lib/asyncio/proactor_events.py | 1 | ||||
-rw-r--r-- | Lib/asyncio/selector_events.py | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 5f1bff7..2e00713 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -185,6 +185,14 @@ class BaseEventLoop(events.AbstractEventLoop): """ self.call_soon(_raise_stop_error) + def close(self): + self._ready.clear() + self._scheduled.clear() + executor = self._default_executor + if executor is not None: + self._default_executor = None + executor.shutdown(wait=False) + def is_running(self): """Returns running status of event loop.""" return self._running diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py index 665569f..cb8625d 100644 --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -276,6 +276,7 @@ class BaseProactorEventLoop(base_events.BaseEventLoop): self._proactor.close() self._proactor = None self._selector = None + super().close() def sock_recv(self, sock, n): return self._proactor.recv(sock, n) diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index dee2306..6cffdd4 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -56,6 +56,7 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop): self._close_self_pipe() self._selector.close() self._selector = None + super().close() def _socketpair(self): raise NotImplementedError |