[Python-checkins] cpython (merge 3.4 -> default): (Merge 3.4) Issue #18174: Fix leak of file descriptor in test_tempfile

victor.stinner python-checkins at python.org
Tue Jul 29 01:15:58 CEST 2014


http://hg.python.org/cpython/rev/017d701116d5
changeset:   91914:017d701116d5
parent:      91912:0ced2d2325fb
parent:      91913:746339776f19
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Jul 29 01:15:22 2014 +0200
summary:
  (Merge 3.4) Issue #18174: Fix leak of file descriptor in test_tempfile

files:
  Lib/test/test_tempfile.py |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -762,8 +762,10 @@
     def test_no_leak_fd(self):
         # Issue #21058: don't leak file descriptor when io.open() fails
         closed = []
+        os_close = os.close
         def close(fd):
             closed.append(fd)
+            os_close(fd)
 
         with mock.patch('os.close', side_effect=close):
             with mock.patch('io.open', side_effect=ValueError):
@@ -1076,8 +1078,10 @@
         def test_no_leak_fd(self):
             # Issue #21058: don't leak file descriptor when io.open() fails
             closed = []
+            os_close = os.close
             def close(fd):
                 closed.append(fd)
+                os_close(fd)
 
             with mock.patch('os.close', side_effect=close):
                 with mock.patch('io.open', side_effect=ValueError):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list