[pypy-svn] pypy default: Maybe we should print a ResourceWarning, but at least don't leak too many

amauryfa commits-noreply at bitbucket.org
Mon Jan 17 18:06:24 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r40790:d10c0b38c10d
Date: 2011-01-17 17:59 +0100
http://bitbucket.org/pypy/pypy/changeset/d10c0b38c10d/

Log:	Maybe we should print a ResourceWarning, but at least don't leak too
	many process handles on Windows.

diff --git a/lib_pypy/_subprocess.py b/lib_pypy/_subprocess.py
--- a/lib_pypy/_subprocess.py
+++ b/lib_pypy/_subprocess.py
@@ -96,6 +96,10 @@
     def __int__(self):
         return self.handle
 
+    def __del__(self):
+        if self.handle is not None:
+            _CloseHandle(self.handle)
+
     def Detach(self):
         handle, self.handle = self.handle, None
         return handle


More information about the Pypy-commit mailing list