Commit e71268f9 authored by Georg Brandl's avatar Georg Brandl

#3205: bz2 iterator fails silently on MemoryError

(backport from r65609)
parent 03221545
......@@ -145,6 +145,9 @@ Library
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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment