From 7611964b2cb82e38f3354e665bbe6c9e7efa8cb6 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 28 Jul 2014 22:07:07 +0200 Subject: [PATCH] Fix test_bytes when sys.stdin is None, for example on Windows when using pythonw.exe instead of python.exe --- Lib/test/test_bytes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index f350211f713..43b6c824a83 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -700,7 +700,7 @@ class BytesTest(BaseBytesTest, unittest.TestCase): type2test = bytes def test_buffer_is_readonly(self): - fd = os.dup(sys.stdin.fileno()) + fd = os.open(__file__, os.O_RDONLY) with open(fd, "rb", buffering=0) as f: self.assertRaises(TypeError, f.readinto, b"")