mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #20437: Fixed 22 potential bugs when deleting objects references.
This commit is contained in:
commit
dfe98a102e
15 changed files with 34 additions and 63 deletions
|
@ -879,8 +879,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) {
|
||||
|
@ -926,8 +925,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue