summaryrefslogtreecommitdiffstats
path: root/Objects/listobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r--Objects/listobject.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 49d977e..36bbe22 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -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 */