diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-27 13:51:32 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-27 13:51:32 (GMT) |
| commit | 1ed017ae92b32b27186d5793f6e58c526f350a2b (patch) | |
| tree | 05fec1ee9e107911f46d85f86efcabce50ff5680 /Modules/_collectionsmodule.c | |
| parent | 726fc139a5f40d81a0013c856be1283da08de4a0 (diff) | |
| download | cpython-1ed017ae92b32b27186d5793f6e58c526f350a2b.zip cpython-1ed017ae92b32b27186d5793f6e58c526f350a2b.tar.gz cpython-1ed017ae92b32b27186d5793f6e58c526f350a2b.tar.bz2 | |
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.
Diffstat (limited to 'Modules/_collectionsmodule.c')
| -rw-r--r-- | Modules/_collectionsmodule.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index e3d1910..6a53584 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -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; } |
