]> granicus.if.org Git - python/commitdiff
Issue #11453, #18174: Fix leak of file descriptor in test_asyncore
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 28 Jul 2014 23:01:09 +0000 (01:01 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 28 Jul 2014 23:01:09 +0000 (01:01 +0200)
Lib/test/test_asyncore.py

index 6cfe58002659ec18b73db25e0377b4d374a543f8..d44726d11f12a0ed38dbd58c5eec43bee9a972f4 100644 (file)
@@ -440,6 +440,8 @@ class FileWrapperTest(unittest.TestCase):
         # 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 @@ class FileWrapperTest(unittest.TestCase):
     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