[Python-checkins] r60878 - in python/trunk: Lib/test/test_mmap.py Misc/NEWS Modules/mmapmodule.c
facundo.batista
python-checkins at python.org
Sun Feb 17 19:59:29 CET 2008
Author: facundo.batista
Date: Sun Feb 17 19:59:29 2008
New Revision: 60878
Modified:
python/trunk/Lib/test/test_mmap.py
python/trunk/Misc/NEWS
python/trunk/Modules/mmapmodule.c
Log:
Issue 2112. mmap does not raises EnvironmentError no more, but
a subclass of it. Thanks John Lenton.
Modified: python/trunk/Lib/test/test_mmap.py
==============================================================================
--- python/trunk/Lib/test/test_mmap.py (original)
+++ python/trunk/Lib/test/test_mmap.py Sun Feb 17 19:59:29 2008
@@ -436,6 +436,11 @@
self.assertRaises(TypeError, m.write, "foo")
+ def test_error(self):
+ self.assert_(issubclass(mmap.error, EnvironmentError))
+ self.assert_("mmap.error" in str(mmap.error))
+
+
def test_main():
run_unittest(MmapTests)
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Sun Feb 17 19:59:29 2008
@@ -1149,6 +1149,9 @@
Extension Modules
-----------------
+- #2112: mmap.error is now a subclass of EnvironmentError and not a
+ direct EnvironmentError
+
- 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.
Modified: python/trunk/Modules/mmapmodule.c
==============================================================================
--- python/trunk/Modules/mmapmodule.c (original)
+++ python/trunk/Modules/mmapmodule.c Sun Feb 17 19:59:29 2008
@@ -1402,7 +1402,10 @@
dict = PyModule_GetDict(module);
if (!dict)
return;
- mmap_module_error = PyExc_EnvironmentError;
+ mmap_module_error = PyErr_NewException("mmap.error",
+ PyExc_EnvironmentError , NULL);
+ if (mmap_module_error == NULL)
+ return;
PyDict_SetItemString(dict, "error", mmap_module_error);
PyDict_SetItemString(dict, "mmap", (PyObject*) &mmap_object_type);
#ifdef PROT_EXEC
More information about the Python-checkins
mailing list