diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-09 11:33:53 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-09 11:33:53 (GMT) |
commit | 505ff755d704c73ac613d3e8fed02c79c6ae555a (patch) | |
tree | b9b0142cbeca125a1bcf0413e48d938d0cd390d3 /Objects/tupleobject.c | |
parent | e9c31470e1680b7c9b9ee83c378b891e90ac58ab (diff) | |
download | cpython-505ff755d704c73ac613d3e8fed02c79c6ae555a.zip cpython-505ff755d704c73ac613d3e8fed02c79c6ae555a.tar.gz cpython-505ff755d704c73ac613d3e8fed02c79c6ae555a.tar.bz2 |
Issue #20437: Fixed 21 potential bugs when deleting objects references.
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r-- | Objects/tupleobject.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index ec3f91b..123df8c 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -866,8 +866,7 @@ _PyTuple_Resize(PyObject **pv, Py_ssize_t newsize) _Py_ForgetReference((PyObject *) v); /* DECREF items deleted by shrinkage */ for (i = newsize; i < oldsize; i++) { - Py_XDECREF(v->ob_item[i]); - v->ob_item[i] = NULL; + Py_CLEAR(v->ob_item[i]); } sv = PyObject_GC_Resize(PyTupleObject, v, newsize); if (sv == NULL) { @@ -913,8 +912,7 @@ PyTuple_Fini(void) #if PyTuple_MAXSAVESIZE > 0 /* empty tuples are used all over the place and applications may * rely on the fact that an empty tuple is a singleton. */ - Py_XDECREF(free_list[0]); - free_list[0] = NULL; + Py_CLEAR(free_list[0]); (void)PyTuple_ClearFreeList(); #endif |