[Python-checkins] r43507 - python/branches/release24-maint/Objects/fileobject.c
georg.brandl
python-checkins at python.org
Fri Mar 31 22:31:06 CEST 2006
Author: georg.brandl
Date: Fri Mar 31 22:31:05 2006
New Revision: 43507
Modified:
python/branches/release24-maint/Objects/fileobject.c
Log:
Bug #1177964: make file iterator raise MemoryError on too big files
(backport from rev. 43506)
Modified: python/branches/release24-maint/Objects/fileobject.c
==============================================================================
--- python/branches/release24-maint/Objects/fileobject.c (original)
+++ python/branches/release24-maint/Objects/fileobject.c Fri Mar 31 22:31:05 2006
@@ -1697,7 +1697,7 @@
/* Make sure that file has a readahead buffer with at least one byte
(unless at EOF) and no more than bufsize. Returns negative value on
- error */
+ error, will set MemoryError if bufsize bytes cannot be allocated. */
static int
readahead(PyFileObject *f, int bufsize)
{
@@ -1710,6 +1710,7 @@
drop_readahead(f);
}
if ((f->f_buf = PyMem_Malloc(bufsize)) == NULL) {
+ PyErr_NoMemory();
return -1;
}
Py_BEGIN_ALLOW_THREADS
More information about the Python-checkins
mailing list