diff options
author | Christian Heimes <christian@cheimes.de> | 2008-02-15 08:20:11 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-02-15 08:20:11 (GMT) |
commit | 7adfad850a50722464775d57b5d16b850ecab56a (patch) | |
tree | 876709cd5987e91a120a0d9af22764663237f9e6 /Lib | |
parent | 2f0da53d28b316197a94919c96195a514acc668f (diff) | |
download | cpython-7adfad850a50722464775d57b5d16b850ecab56a.zip cpython-7adfad850a50722464775d57b5d16b850ecab56a.tar.gz cpython-7adfad850a50722464775d57b5d16b850ecab56a.tar.bz2 |
Bug #2111: mmap segfaults when trying to write a block opened with PROT_READ
Thanks to Thomas Herve for the fix.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_mmap.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 91d6275..2d87ead 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -426,6 +426,13 @@ class MmapTests(unittest.TestCase): return mmap.mmap.__new__(klass, -1, *args, **kwargs) anon_mmap(PAGESIZE) + def test_prot_readonly(self): + mapsize = 10 + open(TESTFN, "wb").write("a"*mapsize) + f = open(TESTFN, "rb") + m = mmap.mmap(f.fileno(), mapsize, prot=mmap.PROT_READ) + self.assertRaises(TypeError, m.write, "foo") + def test_main(): run_unittest(MmapTests) |