summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2022-11-28 10:46:40 (GMT)
committerGitHub <noreply@github.com>2022-11-28 10:46:40 (GMT)
commit53eef27133c1da395b3b4d7ce0ab1d5b743ffb41 (patch)
tree4549e5244c14603b79f0da28db8e1d8220796dfb /Lib/test/test_io.py
parent492dc02b01828f346dd62412fefc654e781de923 (diff)
downloadcpython-53eef27133c1da395b3b4d7ce0ab1d5b743ffb41.zip
cpython-53eef27133c1da395b3b4d7ce0ab1d5b743ffb41.tar.gz
cpython-53eef27133c1da395b3b4d7ce0ab1d5b743ffb41.tar.bz2
bpo-31718: Fix io.IncrementalNewlineDecoder SystemErrors and segfaults (#18640)
Co-authored-by: Oren Milman <orenmn@gmail.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r--Lib/test/test_io.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index c927f15..c5f2e50 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -3945,7 +3945,15 @@ class IncrementalNewlineDecoderTest(unittest.TestCase):
self.assertEqual(decoder.decode(b"\r\r\n"), "\r\r\n")
class CIncrementalNewlineDecoderTest(IncrementalNewlineDecoderTest):
- pass
+ @support.cpython_only
+ def test_uninitialized(self):
+ uninitialized = self.IncrementalNewlineDecoder.__new__(
+ self.IncrementalNewlineDecoder)
+ self.assertRaises(ValueError, uninitialized.decode, b'bar')
+ self.assertRaises(ValueError, uninitialized.getstate)
+ self.assertRaises(ValueError, uninitialized.setstate, (b'foo', 0))
+ self.assertRaises(ValueError, uninitialized.reset)
+
class PyIncrementalNewlineDecoderTest(IncrementalNewlineDecoderTest):
pass