From: Victor Stinner Date: Mon, 28 Jul 2014 23:01:09 +0000 (+0200) Subject: Issue #11453, #18174: Fix leak of file descriptor in test_asyncore X-Git-Tag: v3.4.2rc1~174 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=623138c1635f865fac4ab45af34048d5c7f42e37;p=python Issue #11453, #18174: Fix leak of file descriptor in test_asyncore --- diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index 6cfe580026..d44726d11f 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -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