[Python-checkins] python/dist/src/Modules cStringIO.c, 2.49, 2.49.2.1
mwh@users.sourceforge.net
mwh at users.sourceforge.net
Mon Sep 26 15:15:37 CEST 2005
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv360/Modules
Modified Files:
Tag: release24-maint
cStringIO.c
Log Message:
Backport (with Anthony's blessing (in fact he reminded me to do it :)):
Patches #1298449 and #1298499: Add some missing checks for error
returns in cStringIO.c. Thanks to Andrew Bennetts.
This must be a backport candidate.
Index: cStringIO.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/cStringIO.c,v
retrieving revision 2.49
retrieving revision 2.49.2.1
diff -u -d -r2.49 -r2.49.2.1
--- cStringIO.c 21 Aug 2004 06:55:43 -0000 2.49
+++ cStringIO.c 26 Sep 2005 13:15:34 -0000 2.49.2.1
@@ -241,7 +241,10 @@
line = PyString_FromStringAndSize (output, n);
if (!line)
goto err;
- PyList_Append (result, line);
+ if (PyList_Append (result, line) == -1) {
+ Py_DECREF (line);
+ goto err;
+ }
Py_DECREF (line);
length += n;
if (hint > 0 && length >= hint)
@@ -440,11 +443,17 @@
Py_DECREF(it);
Py_DECREF(s);
return NULL;
- }
- Py_DECREF(s);
- }
- Py_DECREF(it);
- Py_RETURN_NONE;
+ }
+ Py_DECREF(s);
+ }
+
+ Py_DECREF(it);
+
+ /* See if PyIter_Next failed */
+ if (PyErr_Occurred())
+ return NULL;
+
+ Py_RETURN_NONE;
}
static struct PyMethodDef O_methods[] = {
More information about the Python-checkins
mailing list