diff options
author | Guido van Rossum <guido@python.org> | 1993-10-27 14:56:44 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-10-27 14:56:44 (GMT) |
commit | dc4b93db7097a34cee492b188ec2fd65c5b9bc4b (patch) | |
tree | bff2a16f6aa6674ab8463f118de3124a8f393af7 /Objects | |
parent | 4bd023f88291cedbae91f2dea4b13509fc5c2d9a (diff) | |
download | cpython-dc4b93db7097a34cee492b188ec2fd65c5b9bc4b.zip cpython-dc4b93db7097a34cee492b188ec2fd65c5b9bc4b.tar.gz cpython-dc4b93db7097a34cee492b188ec2fd65c5b9bc4b.tar.bz2 |
* listobject.c (list_ass_slice): XDECREF instead of DECREF so
setlistslice() can be used to cut the unused part out of a freshly made
slice (as done by bagof()). [needed by the next mod!]
* structural changes to bagof(), map() etc.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/listobject.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 67a6185..22eab71 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -401,9 +401,9 @@ list_ass_slice(a, ilow, ihigh, v) ihigh = a->ob_size; item = a->ob_item; d = n - (ihigh-ilow); - if (d <= 0) { /* Delete -d items; DECREF ihigh-ilow items */ + if (d <= 0) { /* Delete -d items; XDECREF ihigh-ilow items */ for (k = ilow; k < ihigh; k++) - DECREF(item[k]); + XDECREF(item[k]); if (d < 0) { for (/*k = ihigh*/; k < a->ob_size; k++) item[k+d] = item[k]; @@ -412,7 +412,7 @@ list_ass_slice(a, ilow, ihigh, v) a->ob_item = item; } } - else { /* Insert d items; DECREF ihigh-ilow items */ + else { /* Insert d items; XDECREF ihigh-ilow items */ RESIZE(item, object *, a->ob_size + d); if (item == NULL) { err_nomem(); @@ -421,13 +421,13 @@ list_ass_slice(a, ilow, ihigh, v) for (k = a->ob_size; --k >= ihigh; ) item[k+d] = item[k]; for (/*k = ihigh-1*/; k >= ilow; --k) - DECREF(item[k]); + XDECREF(item[k]); a->ob_item = item; a->ob_size += d; } for (k = 0; k < n; k++, ilow++) { object *w = b->ob_item[k]; - INCREF(w); + XINCREF(w); item[ilow] = w; } return 0; |