summaryrefslogtreecommitdiffstats
path: root/Objects/listobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r--Objects/listobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index a367ed1..44003bc 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -120,6 +120,7 @@ setlistitem(op, i, newitem)
register object *newitem;
{
register object *olditem;
+ register object **p;
if (!is_listobject(op)) {
XDECREF(newitem);
err_badcall();
@@ -130,8 +131,9 @@ setlistitem(op, i, newitem)
err_setstr(IndexError, "list assignment index out of range");
return -1;
}
- olditem = ((listobject *)op) -> ob_item[i];
- ((listobject *)op) -> ob_item[i] = newitem;
+ p = ((listobject *)op) -> ob_item + i;
+ olditem = *p;
+ *p = newitem;
XDECREF(olditem);
return 0;
}