summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r--Lib/test/test_io.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 46b896f..f7c6e2d 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -1191,6 +1191,14 @@ class BufferedReaderTest(unittest.TestCase, CommonBufferedTests):
self.assertEqual(rawio._extraneous_reads, 0,
"failed for {}: {} != 0".format(n, rawio._extraneous_reads))
+ def test_read_on_closed(self):
+ # Issue #23796
+ b = io.BufferedReader(io.BytesIO(b"12"))
+ b.read(1)
+ b.close()
+ self.assertRaises(ValueError, b.peek)
+ self.assertRaises(ValueError, b.read1, 1)
+
class CBufferedReaderTest(BufferedReaderTest, SizeofTest):
tp = io.BufferedReader