bpo-44558: Make the implementation consistency of operator.indexOf (GH-27012)

(cherry picked from commit 09302405d2)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
This commit is contained in:
Miss Islington (bot) 2021-07-05 02:52:04 -07:00 committed by GitHub
parent fe847a6285
commit 9f47d872db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View file

@ -173,7 +173,7 @@ def getitem(a, b):
def indexOf(a, b):
"Return the first index of b in a."
for i, j in enumerate(a):
if j == b:
if j is b or j == b:
return i
else:
raise ValueError('sequence.index(x): x not in sequence')