mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Patch #708604: Check more function results. Will backport to 2.2.
This commit is contained in:
parent
bcd93962ce
commit
cd12bfc142
2 changed files with 45 additions and 8 deletions
|
|
@ -473,6 +473,8 @@ list_ass_slice(PyListObject *a, int ilow, int ihigh, PyObject *v)
|
|||
/* Special case "a[i:j] = a" -- copy b first */
|
||||
int ret;
|
||||
v = list_slice(b, 0, n);
|
||||
if (v == NULL)
|
||||
return -1;
|
||||
ret = list_ass_slice(a, ilow, ihigh, v);
|
||||
Py_DECREF(v);
|
||||
return ret;
|
||||
|
|
@ -488,8 +490,13 @@ list_ass_slice(PyListObject *a, int ilow, int ihigh, PyObject *v)
|
|||
ihigh = a->ob_size;
|
||||
item = a->ob_item;
|
||||
d = n - (ihigh-ilow);
|
||||
if (ihigh > ilow)
|
||||
if (ihigh > ilow) {
|
||||
p = recycle = PyMem_NEW(PyObject *, (ihigh-ilow));
|
||||
if (recycle == NULL) {
|
||||
PyErr_NoMemory();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
p = recycle = NULL;
|
||||
if (d <= 0) { /* Delete -d items; recycle ihigh-ilow items */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue