diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-10-01 01:17:15 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-10-01 01:17:15 (GMT) |
commit | 95bc0e4703f6997b808240b3b24635bb2bebd781 (patch) | |
tree | eaa511cccd307ef891ab31f0cc860aa10569e086 /Lib | |
parent | ece9d5a91fbc4ada2d4e17e9c52d4a1658552dca (diff) | |
download | cpython-95bc0e4703f6997b808240b3b24635bb2bebd781.zip cpython-95bc0e4703f6997b808240b3b24635bb2bebd781.tar.gz cpython-95bc0e4703f6997b808240b3b24635bb2bebd781.tar.bz2 |
use Py_ssize_t for file offset and length computations in iteration (closes #22526)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_file2k.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_file2k.py b/Lib/test/test_file2k.py index fae1db6..14e5931 100644 --- a/Lib/test/test_file2k.py +++ b/Lib/test/test_file2k.py @@ -436,6 +436,18 @@ class OtherFileTests(unittest.TestCase): finally: f.close() + @test_support.precisionbigmemtest(2**31, 1) + def test_very_long_line(self, maxsize): + # Issue #22526 + with open(TESTFN, "wb") as fp: + fp.write("\0"*2**31) + with open(TESTFN, "rb") as fp: + for l in fp: + pass + self.assertEqual(len(l), 2**31) + self.assertEqual(l.count("\0"), 2**31) + l = None + class FileSubclassTests(unittest.TestCase): def testExit(self): |