diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-06-17 07:17:14 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2019-06-17 07:17:14 (GMT) |
commit | 28fca0c422b425a6be43be31add0a5328c16b0b8 (patch) | |
tree | af3c6179b46c195c002aee2e30a96e458165cb14 /Lib/test/test_os.py | |
parent | 66d47da86aff15be34adbec02596bb3188684c0d (diff) | |
download | cpython-28fca0c422b425a6be43be31add0a5328c16b0b8.zip cpython-28fca0c422b425a6be43be31add0a5328c16b0b8.tar.gz cpython-28fca0c422b425a6be43be31add0a5328c16b0b8.tar.bz2 |
bpo-37267: Do not check for FILE_TYPE_CHAR in os.dup() on Windows (GH-14051)
On Windows, os.dup() no longer creates an inheritable fd when handling a
character file.
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r-- | Lib/test/test_os.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index a8eae61..b540fcb 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3382,6 +3382,15 @@ class FDInheritanceTests(unittest.TestCase): self.addCleanup(os.close, fd2) self.assertEqual(os.get_inheritable(fd2), False) + @unittest.skipUnless(sys.platform == 'win32', 'win32-specific test') + def test_dup_nul(self): + # os.dup() was creating inheritable fds for character files. + fd1 = os.open('NUL', os.O_RDONLY) + self.addCleanup(os.close, fd1) + fd2 = os.dup(fd1) + self.addCleanup(os.close, fd2) + self.assertFalse(os.get_inheritable(fd2)) + @unittest.skipUnless(hasattr(os, 'dup2'), "need os.dup2()") def test_dup2(self): fd = os.open(__file__, os.O_RDONLY) |