[Python-checkins] cpython: Issue #19299: fix refleak test failures in test_asyncio
antoine.pitrou
python-checkins at python.org
Sun Oct 20 00:55:06 CEST 2013
http://hg.python.org/cpython/rev/4019694a1ce4
changeset: 86497:4019694a1ce4
user: Antoine Pitrou <solipsis at pitrou.net>
date: Sun Oct 20 00:54:10 2013 +0200
summary:
Issue #19299: fix refleak test failures in test_asyncio
files:
Lib/asyncio/base_events.py | 8 ++++++++
Lib/asyncio/proactor_events.py | 1 +
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
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -185,6 +185,14 @@
"""
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
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -276,6 +276,7 @@
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
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -56,6 +56,7 @@
self._close_self_pipe()
self._selector.close()
self._selector = None
+ super().close()
def _socketpair(self):
raise NotImplementedError
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list