[Python-checkins] r65651 - in python/branches/release25-maint: Misc/NEWS Modules/bz2module.c

georg.brandl python-checkins at python.org
Tue Aug 12 10:47:10 CEST 2008


Author: georg.brandl
Date: Tue Aug 12 10:47:02 2008
New Revision: 65651

Log:
#3205: bz2 iterator fails silently on MemoryError
(backport from r65609)


Modified:
   python/branches/release25-maint/Misc/NEWS
   python/branches/release25-maint/Modules/bz2module.c

Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS	(original)
+++ python/branches/release25-maint/Misc/NEWS	Tue Aug 12 10:47:02 2008
@@ -145,6 +145,9 @@
 Extension Modules
 -----------------
 
+- Issue #3205: When iterating over a BZ2File fails allocating memory, raise
+  a MemoryError rather than silently stop the iteration.
+
 - Patch #2111: Avoid mmap segfault when modifying a PROT_READ block.
 
 - zlib.decompressobj().flush(value) no longer crashes the interpreter when

Modified: python/branches/release25-maint/Modules/bz2module.c
==============================================================================
--- python/branches/release25-maint/Modules/bz2module.c	(original)
+++ python/branches/release25-maint/Modules/bz2module.c	Tue Aug 12 10:47:02 2008
@@ -416,6 +416,7 @@
 		return 0;
 	}
 	if ((f->f_buf = PyMem_Malloc(bufsize)) == NULL) {
+		PyErr_NoMemory();
 		return -1;
 	}
 	Py_BEGIN_ALLOW_THREADS


More information about the Python-checkins mailing list