mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
a few peephole optimizations
This commit is contained in:
parent
8d617a60b1
commit
5fe605889a
5 changed files with 12 additions and 8 deletions
|
|
@ -119,9 +119,10 @@ int
|
|||
settupleitem(op, i, newitem)
|
||||
register object *op;
|
||||
register int i;
|
||||
register object *newitem;
|
||||
object *newitem;
|
||||
{
|
||||
register object *olditem;
|
||||
register object **p;
|
||||
if (!is_tupleobject(op)) {
|
||||
XDECREF(newitem);
|
||||
err_badcall();
|
||||
|
|
@ -132,8 +133,9 @@ settupleitem(op, i, newitem)
|
|||
err_setstr(IndexError, "tuple assignment index out of range");
|
||||
return -1;
|
||||
}
|
||||
olditem = ((tupleobject *)op) -> ob_item[i];
|
||||
((tupleobject *)op) -> ob_item[i] = newitem;
|
||||
p = ((tupleobject *)op) -> ob_item + i;
|
||||
olditem = *p;
|
||||
*p = newitem;
|
||||
XDECREF(olditem);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue