From 47d305d6891ebc049153086585a3b486cb71a415 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Sat, 16 Aug 2008 23:28:44 +0000 Subject: [PATCH] Issue #3571: test_bytes mistakingly closed stdin --- Lib/test/test_bytes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index 230dbf46bed..c64ac192e5d 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -454,7 +454,8 @@ class BytesTest(BaseBytesTest): type2test = bytes def test_buffer_is_readonly(self): - with open(sys.stdin.fileno(), "rb", buffering=0) as f: + fd = os.dup(sys.stdin.fileno()) + with open(fd, "rb", buffering=0) as f: self.assertRaises(TypeError, f.readinto, b"")