This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sbt
Recipients doerwalter, sbt
Date 2012-07-23.18:20:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1343067641.07.0.697106944777.issue15408@psf.upfronthosting.co.za>
In-reply-to
Content
A program which depends on the old behaviour would be broken on a non-refcounted implementation of Python, so I would be inclined to say "won't fix".

However, I think the following patch would restore the old behaviour

diff -r a970054a93fb Lib/os.py
--- a/Lib/os.py	Mon Jul 16 18:30:03 2012 +0100
+++ b/Lib/os.py	Mon Jul 23 19:12:38 2012 +0100
@@ -1004,6 +1004,13 @@
 # Helper for popen() -- a proxy for a file whose close waits for the process
 class _wrap_close:
     def __init__(self, stream, proc):
+        # proc should be waited on when stream is garbage collected
+        import weakref
+        def callback(wr):
+            proc._weakref = None           # break ref cycle
+            proc.wait()
+        proc._weakref = weakref.ref(stream, callback)
+        proc.stdin = proc.stdout = None    # proc must not keep stream alive
         self._stream = stream
         self._proc = proc
     def close(self):
History
Date User Action Args
2012-07-23 18:20:41sbtsetrecipients: + sbt, doerwalter
2012-07-23 18:20:41sbtsetmessageid: <1343067641.07.0.697106944777.issue15408@psf.upfronthosting.co.za>
2012-07-23 18:20:40sbtlinkissue15408 messages
2012-07-23 18:20:40sbtcreate