mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
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:
parent
726fc139a5
commit
1ed017ae92
9 changed files with 23 additions and 71 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue