[Python-checkins] r65609 - in python/trunk: Misc/NEWS Modules/bz2module.c

antoine.pitrou python-checkins at python.org
Sat Aug 9 19:22:26 CEST 2008


Author: antoine.pitrou
Date: Sat Aug  9 19:22:25 2008
New Revision: 65609

Log:
#3205: bz2 iterator fails silently on MemoryError



Modified:
   python/trunk/Misc/NEWS
   python/trunk/Modules/bz2module.c

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sat Aug  9 19:22:25 2008
@@ -12,6 +12,9 @@
 Core and Builtins
 -----------------
 
+- Issue #3205: When iterating over a BZ2File fails allocating memory, raise
+  a MemoryError rather than silently stop the iteration.
+
 - Issue #1481296: Make long(float('nan')) and int(float('nan')) raise
   ValueError consistently across platforms.
 

Modified: python/trunk/Modules/bz2module.c
==============================================================================
--- python/trunk/Modules/bz2module.c	(original)
+++ python/trunk/Modules/bz2module.c	Sat Aug  9 19:22:25 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