[Python-checkins] r76057 - python/trunk/Objects/listobject.c
benjamin.peterson
python-checkins at python.org
Mon Nov 2 16:06:45 CET 2009
Author: benjamin.peterson
Date: Mon Nov 2 16:06:45 2009
New Revision: 76057
Log:
prevent a rather unlikely segfault
Modified:
python/trunk/Objects/listobject.c
Modified: python/trunk/Objects/listobject.c
==============================================================================
--- python/trunk/Objects/listobject.c (original)
+++ python/trunk/Objects/listobject.c Mon Nov 2 16:06:45 2009
@@ -183,9 +183,12 @@
return NULL;
}
if (i < 0 || i >= Py_SIZE(op)) {
- if (indexerr == NULL)
+ if (indexerr == NULL) {
indexerr = PyString_FromString(
"list index out of range");
+ if (indexerr == NULL)
+ return NULL;
+ }
PyErr_SetObject(PyExc_IndexError, indexerr);
return NULL;
}
@@ -447,9 +450,12 @@
list_item(PyListObject *a, Py_ssize_t i)
{
if (i < 0 || i >= Py_SIZE(a)) {
- if (indexerr == NULL)
+ if (indexerr == NULL) {
indexerr = PyString_FromString(
"list index out of range");
+ if (indexerr == NULL)
+ return NULL;
+ }
PyErr_SetObject(PyExc_IndexError, indexerr);
return NULL;
}
More information about the Python-checkins
mailing list