mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
SF patch #1005778, Fix seg fault if list object is modified during list.index()
Backport candidate
This commit is contained in:
parent
39689c5c6a
commit
f076953eb1
3 changed files with 17 additions and 3 deletions
|
|
@ -2186,9 +2186,7 @@ listindex(PyListObject *self, PyObject *args)
|
|||
if (stop < 0)
|
||||
stop = 0;
|
||||
}
|
||||
else if (stop > self->ob_size)
|
||||
stop = self->ob_size;
|
||||
for (i = start; i < stop; i++) {
|
||||
for (i = start; i < stop && i < self->ob_size; i++) {
|
||||
int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ);
|
||||
if (cmp > 0)
|
||||
return PyInt_FromLong((long)i);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue