summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2013-02-13 12:18:03 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2013-02-13 12:18:03 (GMT)
commit0d09ba8e0bc57b50984d1968aab3c29de3e1320d (patch)
treea91dea1de06d69f47b0ba922c4b46467b6f7c15a /Lib
parent7e0191170e95ffd9c95d840a5631e0f1831998f9 (diff)
downloadcpython-0d09ba8e0bc57b50984d1968aab3c29de3e1320d.zip
cpython-0d09ba8e0bc57b50984d1968aab3c29de3e1320d.tar.gz
cpython-0d09ba8e0bc57b50984d1968aab3c29de3e1320d.tar.bz2
Issue #16743: Fix mmap overflow check on 32 bit Windows
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_mmap.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py
index 28b52a9..4407c5c 100644
--- a/Lib/test/test_mmap.py
+++ b/Lib/test/test_mmap.py
@@ -693,6 +693,13 @@ class LargeMmapTests(unittest.TestCase):
def test_large_filesize(self):
with self._make_test_file(0x17FFFFFFF, b" ") as f:
+ if sys.maxsize < 0x180000000:
+ # On 32 bit platforms the file is larger than sys.maxsize so
+ # mapping the whole file should fail -- Issue #16743
+ with self.assertRaises(OverflowError):
+ mmap.mmap(f.fileno(), 0x180000000, access=mmap.ACCESS_READ)
+ with self.assertRaises(ValueError):
+ mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
with mmap.mmap(f.fileno(), 0x10000, access=mmap.ACCESS_READ) as m:
self.assertEqual(m.size(), 0x180000000)