]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#3205: bz2 iterator fails silently on MemoryError
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 9 Aug 2008 17:22:25 +0000 (17:22 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 9 Aug 2008 17:22:25 +0000 (17:22 +0000)
Misc/NEWS
Modules/bz2module.c

index cabee7f6de26d09e37b6d9d4b7f2597ad6bca478..c6c401f5e46c31db95125085791608e66d27c934 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.6 beta 3?
 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.
 
index 16201bd6486c5bfbe66df646ea99553fa0452514..39292197d8ed27914e5a08608f01689f834ba19a 100644 (file)
@@ -416,6 +416,7 @@ Util_ReadAhead(BZ2FileObject *f, int bufsize)
                return 0;
        }
        if ((f->f_buf = PyMem_Malloc(bufsize)) == NULL) {
+               PyErr_NoMemory();
                return -1;
        }
        Py_BEGIN_ALLOW_THREADS