diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-01-29 16:50:58 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-01-29 16:50:58 (GMT) |
commit | 978a9afc6af6c137065bdcf7ae4ef5450e5b2ec2 (patch) | |
tree | 54eb1a4cdf09be18b62c40e0e203a347c37c4cd6 /Lib/asyncio/windows_utils.py | |
parent | 3c0cf05901ea5cca0694734fd4a64b2bc267cb41 (diff) | |
download | cpython-978a9afc6af6c137065bdcf7ae4ef5450e5b2ec2.zip cpython-978a9afc6af6c137065bdcf7ae4ef5450e5b2ec2.tar.gz cpython-978a9afc6af6c137065bdcf7ae4ef5450e5b2ec2.tar.bz2 |
Issue #23243, asyncio: Emit a ResourceWarning when an event loop or a transport
is not explicitly closed. Close also explicitly transports in test_sslproto.
Diffstat (limited to 'Lib/asyncio/windows_utils.py')
-rw-r--r-- | Lib/asyncio/windows_utils.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/asyncio/windows_utils.py b/Lib/asyncio/windows_utils.py index 5f8327e..870cd13 100644 --- a/Lib/asyncio/windows_utils.py +++ b/Lib/asyncio/windows_utils.py @@ -14,6 +14,7 @@ import os import socket import subprocess import tempfile +import warnings __all__ = ['socketpair', 'pipe', 'Popen', 'PIPE', 'PipeHandle'] @@ -156,7 +157,10 @@ class PipeHandle: CloseHandle(self._handle) self._handle = None - __del__ = close + def __del__(self): + if self._handle is not None: + warnings.warn("unclosed %r" % self, ResourceWarning) + self.close() def __enter__(self): return self |