mirror of
https://github.com/python/cpython.git
synced 2026-04-22 03:41:08 +00:00
bpo-35441: Remove dead and buggy code related to PyList_SetItem(). (GH-11033)
In _localemodule.c and selectmodule.c, remove dead code that would
cause double decrefs if run.
In addition, replace PyList_SetItem() with PyList_SET_ITEM() in cases
where a new list is populated and there is no possibility of an error.
In addition, check if the list changed size in the loop in array_array_fromlist().
(cherry picked from commit 99d56b5356)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
This commit is contained in:
parent
ee2c5a8e2d
commit
8b7d8ac09c
7 changed files with 25 additions and 30 deletions
|
|
@ -5056,7 +5056,7 @@ getarray(long a[256])
|
|||
Py_DECREF(l);
|
||||
return NULL;
|
||||
}
|
||||
PyList_SetItem(l, i, x);
|
||||
PyList_SET_ITEM(l, i, x);
|
||||
}
|
||||
for (i = 0; i < 256; i++)
|
||||
a[i] = 0;
|
||||
|
|
@ -5078,7 +5078,7 @@ _Py_GetDXProfile(PyObject *self, PyObject *args)
|
|||
Py_DECREF(l);
|
||||
return NULL;
|
||||
}
|
||||
PyList_SetItem(l, i, x);
|
||||
PyList_SET_ITEM(l, i, x);
|
||||
}
|
||||
return l;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -2544,7 +2544,7 @@ makepathobject(const wchar_t *path, wchar_t delim)
|
|||
Py_DECREF(v);
|
||||
return NULL;
|
||||
}
|
||||
PyList_SetItem(v, i, w);
|
||||
PyList_SET_ITEM(v, i, w);
|
||||
if (*p == '\0')
|
||||
break;
|
||||
path = p+1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue