[Python-checkins] r60833 - in python/branches/trunk-math: Lib/test/test_mmap.py Misc/NEWS Modules/mmapmodule.c
christian.heimes
python-checkins at python.org
Fri Feb 15 11:39:12 CET 2008
Author: christian.heimes
Date: Fri Feb 15 11:39:12 2008
New Revision: 60833
Modified:
python/branches/trunk-math/ (props changed)
python/branches/trunk-math/Lib/test/test_mmap.py
python/branches/trunk-math/Misc/NEWS
python/branches/trunk-math/Modules/mmapmodule.c
Log:
Merged revisions 60828-60832 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60830 | christian.heimes | 2008-02-15 09:20:11 +0100 (Fri, 15 Feb 2008) | 2 lines
Bug #2111: mmap segfaults when trying to write a block opened with PROT_READ
Thanks to Thomas Herve for the fix.
........
Modified: python/branches/trunk-math/Lib/test/test_mmap.py
==============================================================================
--- python/branches/trunk-math/Lib/test/test_mmap.py (original)
+++ python/branches/trunk-math/Lib/test/test_mmap.py Fri Feb 15 11:39:12 2008
@@ -426,6 +426,13 @@
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)
Modified: python/branches/trunk-math/Misc/NEWS
==============================================================================
--- python/branches/trunk-math/Misc/NEWS (original)
+++ python/branches/trunk-math/Misc/NEWS Fri Feb 15 11:39:12 2008
@@ -1152,6 +1152,8 @@
Extension Modules
-----------------
+- Bug #2111: mmap segfaults when trying to write a block opened with PROT_READ
+
- #2063: correct order of utime and stime in os.times() result on Windows.
- Patch #1736: Fix file name handling of _msi.FCICreate.
Modified: python/branches/trunk-math/Modules/mmapmodule.c
==============================================================================
--- python/branches/trunk-math/Modules/mmapmodule.c (original)
+++ python/branches/trunk-math/Modules/mmapmodule.c Fri Feb 15 11:39:12 2008
@@ -1122,6 +1122,10 @@
"mmap invalid access parameter.");
}
+ if (prot == PROT_READ) {
+ access = ACCESS_READ;
+ }
+
#ifdef HAVE_FSTAT
# ifdef __VMS
/* on OpenVMS we must ensure that all bytes are written to the file */
More information about the Python-checkins
mailing list