mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
PySequence_Index(): set exception when object is not found in
sequence, otherwise operator.indexOf([4, 3, 2, 1], 9) would raise a SystemError! Note: it might be wise to double check all these functions. I haven't done that yet.
This commit is contained in:
parent
2e6313930e
commit
f90eddef5d
1 changed files with 1 additions and 0 deletions
|
@ -912,6 +912,7 @@ PySequence_Index(s, o)
|
||||||
if(err) return -1;
|
if(err) return -1;
|
||||||
if(! not_equal) return i;
|
if(! not_equal) return i;
|
||||||
}
|
}
|
||||||
|
PyErr_SetString(PyExc_ValueError, "list.index(x): x not in list");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue