summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-06-17 01:45:04 -0700
committerVictor Stinner <vstinner@redhat.com>2019-06-17 10:45:04 +0200
commit71589491ad0da27f57789b97354f6094a91e2eb3 (patch)
tree80e64e545573b4391deb32352eb88e86e35cc830 /Lib
parent351b0e793e35510e8cbbcbb455a1b9544e808cdd (diff)
downloadcpython-git-71589491ad0da27f57789b97354f6094a91e2eb3.tar.gz
bpo-37267: Do not check for FILE_TYPE_CHAR in os.dup() on Windows (GH-14051) (GH-14141)
On Windows, os.dup() no longer creates an inheritable fd when handling a character file. (cherry picked from commit 28fca0c422b425a6be43be31add0a5328c16b0b8) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_os.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index fd9f70e30d..a917050400 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -3240,6 +3240,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)