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

victor.stinner python-checkins at python.org
Tue Jul 29 01:02:00 CEST 2014


http://hg.python.org/cpython/rev/379aad232000
changeset:   91911:379aad232000
branch:      3.4
parent:      91909:bc70c1da7faf
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Jul 29 01:01:09 2014 +0200
summary:
  Issue #11453, #18174: Fix leak of file descriptor in test_asyncore

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


diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py
--- a/Lib/test/test_asyncore.py
+++ b/Lib/test/test_asyncore.py
@@ -440,6 +440,8 @@
         # Issue #11453
         fd = os.open(support.TESTFN, os.O_RDONLY)
         f = asyncore.file_wrapper(fd)
+
+        os.close(fd)
         with support.check_warnings(('', ResourceWarning)):
             f = None
             support.gc_collect()
@@ -447,6 +449,8 @@
     def test_close_twice(self):
         fd = os.open(support.TESTFN, os.O_RDONLY)
         f = asyncore.file_wrapper(fd)
+        os.close(fd)
+
         f.close()
         self.assertEqual(f.fd, -1)
         # calling close twice should not fail

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


More information about the Python-checkins mailing list