Issue #15261: Stop os.stat(fd) crashing on Windows when fd not open.

This commit is contained in:
Richard Oudkerk 2012-07-06 12:05:32 +01:00
parent 74de153681
commit 2240ac1eae
5 changed files with 37 additions and 6 deletions

View file

@ -146,6 +146,16 @@ class GenericTest(unittest.TestCase):
f.close()
support.unlink(support.TESTFN)
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
def test_exists_fd(self):
r, w = os.pipe()
try:
self.assertTrue(self.pathmodule.exists(r))
finally:
os.close(r)
os.close(w)
self.assertFalse(self.pathmodule.exists(r))
def test_isdir(self):
self.assertIs(self.pathmodule.isdir(support.TESTFN), False)
f = open(support.TESTFN, "wb")