mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-37648: Fixed minor inconsistency in some __contains__. (GH-14904)
The collection's item is now always at the left and the needle is on the right of ==.
This commit is contained in:
parent
17e52649c0
commit
18b711c5a7
12 changed files with 86 additions and 22 deletions
|
@ -449,8 +449,7 @@ list_contains(PyListObject *a, PyObject *el)
|
|||
int cmp;
|
||||
|
||||
for (i = 0, cmp = 0 ; cmp == 0 && i < Py_SIZE(a); ++i)
|
||||
cmp = PyObject_RichCompareBool(el, PyList_GET_ITEM(a, i),
|
||||
Py_EQ);
|
||||
cmp = PyObject_RichCompareBool(PyList_GET_ITEM(a, i), el, Py_EQ);
|
||||
return cmp;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue