[pypy-svn] commit/pypy: antocuni: let popen always use the right file.close(), even if we rebind __builtin__.file
Bitbucket
commits-noreply at bitbucket.org
Fri Dec 17 09:45:42 CET 2010
1 new changeset in pypy:
http://bitbucket.org/pypy/pypy/changeset/70261efaf9ee/
changeset: r40061:70261efaf9ee
user: antocuni
date: 2010-12-17 09:45:32
summary: let popen always use the right file.close(), even if we rebind __builtin__.file
affected #: 2 files (436 bytes)
--- a/pypy/module/posix/app_posix.py Thu Dec 16 16:17:59 2010 +0100
+++ b/pypy/module/posix/app_posix.py Fri Dec 17 09:45:32 2010 +0100
@@ -95,7 +95,7 @@
def close(self):
import os
- file.close(self)
+ super(popenfile, self).close()
pid = self._childpid
if pid is not None:
self._childpid = None
--- a/pypy/module/posix/test/test_posix_libfile.py Thu Dec 16 16:17:59 2010 +0100
+++ b/pypy/module/posix/test/test_posix_libfile.py Fri Dec 17 09:45:32 2010 +0100
@@ -50,3 +50,18 @@
f.close() # should wait here
end_time = time.time()
assert end_time - start_time >= 1.9
+
+ def test_popen_and_rebind_file_in___builtin__(self):
+ import sys
+ if sys.platform.startswith('win'):
+ skip("unix specific")
+ #
+ import __builtin__
+ posix = self.posix
+ orig_file = file
+ try:
+ f = posix.popen('true')
+ __builtin__.file = lambda x : explode
+ f.close()
+ finally:
+ __builtin__.file = orig_file
Repository URL: https://bitbucket.org/pypy/pypy/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the Pypy-commit
mailing list