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

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


http://hg.python.org/cpython/rev/746339776f19
changeset:   91913:746339776f19
branch:      3.4
parent:      91911:379aad232000
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Jul 29 01:13:39 2014 +0200
summary:
  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