[pypy-svn] r61271 - pypy/trunk/lib-python/modified-2.5.2

afa at codespeak.net afa at codespeak.net
Fri Jan 23 17:05:16 CET 2009


Author: afa
Date: Fri Jan 23 17:05:15 2009
New Revision: 61271

Added:
   pypy/trunk/lib-python/modified-2.5.2/subprocess.py
      - copied, changed from r61203, pypy/trunk/lib-python/2.5.2/subprocess.py
Log:
CPython relies on reference counting to close some file and pipe handles.
pypy cannot, and must explicitely close them.

This should make test_subprocess go to the end, even if some tests fail.


Copied: pypy/trunk/lib-python/modified-2.5.2/subprocess.py (from r61203, pypy/trunk/lib-python/2.5.2/subprocess.py)
==============================================================================
--- pypy/trunk/lib-python/2.5.2/subprocess.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/subprocess.py	Fri Jan 23 17:05:15 2009
@@ -740,9 +740,13 @@
 
         def _make_inheritable(self, handle):
             """Return a duplicate of handle, which is inheritable"""
-            return DuplicateHandle(GetCurrentProcess(), handle,
+            dupl = DuplicateHandle(GetCurrentProcess(), handle,
                                    GetCurrentProcess(), 0, 1,
                                    DUPLICATE_SAME_ACCESS)
+            # If the initial handle was obtained with CreatePipe, close it.
+            if not isinstance(handle, int):
+                handle.Close()
+            return dupl
 
 
         def _find_w9xpopen(self):



More information about the Pypy-commit mailing list