Issue #20440: Cleaning up the code by using Py_SETREF and Py_CLEAR.

Old code is correct, but with Py_SETREF and Py_CLEAR it can be cleaner.
This patch doesn't fix bugs and hence there is no need to backport it.
This commit is contained in:
Serhiy Storchaka 2015-12-27 15:51:32 +02:00
parent 726fc139a5
commit 1ed017ae92
9 changed files with 23 additions and 71 deletions

View file

@ -1222,7 +1222,6 @@ deque_del_item(dequeobject *deque, Py_ssize_t i)
static int
deque_ass_item(dequeobject *deque, Py_ssize_t i, PyObject *v)
{
PyObject *old_value;
block *b;
Py_ssize_t n, len=Py_SIZE(deque), halflen=(len+1)>>1, index=i;
@ -1249,9 +1248,7 @@ deque_ass_item(dequeobject *deque, Py_ssize_t i, PyObject *v)
b = b->leftlink;
}
Py_INCREF(v);
old_value = b->data[i];
b->data[i] = v;
Py_DECREF(old_value);
Py_SETREF(b->data[i], v);
return 0;
}