summaryrefslogtreecommitdiff
path: root/asyncio/windows_utils.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-01-29 17:32:39 +0100
committerVictor Stinner <victor.stinner@gmail.com>2015-01-29 17:32:39 +0100
commit190e78603a4ce58a2f248fdf8a3472fa1fc6c064 (patch)
tree0990f66b83b12d6466ba5042bfbb0b02442ab5e7 /asyncio/windows_utils.py
parenta1611f147decd003b0ffe5d10eb011d0b8c2725e (diff)
downloadtrollius-master.tar.gz
Python issue #23243: On Python 3.4 and newer, emit a ResourceWarning when anHEADmaster
event loop or a transport is not explicitly closed
Diffstat (limited to 'asyncio/windows_utils.py')
-rw-r--r--asyncio/windows_utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/asyncio/windows_utils.py b/asyncio/windows_utils.py
index 5f8327e..870cd13 100644
--- a/asyncio/windows_utils.py
+++ b/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