diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-07-11 17:35:06 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-07-11 17:35:06 +0200 |
commit | 6e1ccfe87261a9bc3818d1b4c2409eb1b7db19c5 (patch) | |
tree | c939cd6272e45f3a26b14601869693c2c13c7f88 | |
parent | b28ed92dd0e46db1ba14d76375c7b0a7186249e3 (diff) | |
download | cpython-git-6e1ccfe87261a9bc3818d1b4c2409eb1b7db19c5.tar.gz |
Issue #21932: Ooops, os.read(fd, size) allocates a buffer of size bytes, even
if the file is much smaller. Add @bigmemtest decorator to the new
test_large_read().
-rw-r--r-- | Lib/test/test_os.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 588df1696f..5348b12bb3 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -123,14 +123,15 @@ class FileTests(unittest.TestCase): self.assertEqual(type(s), bytes) self.assertEqual(s, b"spam") - def test_large_read(self): + @support.cpython_only + @support.bigmemtest(size=INT_MAX + 10, memuse=1, dry_run=False) + def test_large_read(self, size): with open(support.TESTFN, "wb") as fp: fp.write(b'test') self.addCleanup(support.unlink, support.TESTFN) # Issue #21932: Make sure that os.read() does not raise an # OverflowError for size larger than INT_MAX - size = INT_MAX + 10 with open(support.TESTFN, "rb") as fp: data = os.read(fp.fileno(), size) |