summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2008-08-09 17:22:25 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2008-08-09 17:22:25 (GMT)
commit016b366df4c8c3fc25f103fadb613fc5254b9f88 (patch)
treedfdefead947dd277a583918d4f0841e8f70b07b7
parent59ce901a2052ca520a0c044f5d547e74cc290061 (diff)
downloadcpython-016b366df4c8c3fc25f103fadb613fc5254b9f88.zip
cpython-016b366df4c8c3fc25f103fadb613fc5254b9f88.tar.gz
cpython-016b366df4c8c3fc25f103fadb613fc5254b9f88.tar.bz2
#3205: bz2 iterator fails silently on MemoryError
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/bz2module.c1
2 files changed, 4 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index cabee7f..c6c401f 100644
--- 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.
diff --git a/Modules/bz2module.c b/Modules/bz2module.c
index 16201bd..3929219 100644
--- a/Modules/bz2module.c
+++ b/Modules/bz2module.c
@@ -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