diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-03-06 23:40:56 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-03-06 23:40:56 (GMT) |
commit | 66913e221312e38cc542896d4db9b45720a20672 (patch) | |
tree | 2260ead42bedd1112e956abf5728e4de7edb18f1 /Lib/test/test_io.py | |
parent | 2db74c2412a785a3b796074f54a7842b8f8f3b9d (diff) | |
download | cpython-66913e221312e38cc542896d4db9b45720a20672.zip cpython-66913e221312e38cc542896d4db9b45720a20672.tar.gz cpython-66913e221312e38cc542896d4db9b45720a20672.tar.bz2 |
Issue #5433: Excessive newline detection optimization in IncrementalNewlineDecoder
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r-- | Lib/test/test_io.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 3189f9c..5fc53ea 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -1915,6 +1915,19 @@ class IncrementalNewlineDecoderTest(unittest.TestCase): decoder = self.IncrementalNewlineDecoder(decoder, translate=True) self.check_newline_decoding_utf8(decoder) + def test_newline_bytes(self): + # Issue 5433: Excessive optimization in IncrementalNewlineDecoder + def _check(dec): + self.assertEquals(dec.newlines, None) + self.assertEquals(dec.decode("\u0D00"), "\u0D00") + self.assertEquals(dec.newlines, None) + self.assertEquals(dec.decode("\u0A00"), "\u0A00") + self.assertEquals(dec.newlines, None) + dec = self.IncrementalNewlineDecoder(None, translate=False) + _check(dec) + dec = self.IncrementalNewlineDecoder(None, translate=True) + _check(dec) + class CIncrementalNewlineDecoderTest(IncrementalNewlineDecoderTest): pass |