From 5c00112d781c06156baa9db88215049580cd8d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Ogam?= Date: Tue, 5 Apr 2022 09:39:44 +0200 Subject: [PATCH] Move an unrelated statement out of a try clause in Sequence.index --- Lib/_collections_abc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/_collections_abc.py b/Lib/_collections_abc.py index 86eb042e3a75ab1..e96e4c353558601 100644 --- a/Lib/_collections_abc.py +++ b/Lib/_collections_abc.py @@ -1022,10 +1022,10 @@ def index(self, value, start=0, stop=None): while stop is None or i < stop: try: v = self[i] - if v is value or v == value: - return i except IndexError: break + if v is value or v == value: + return i i += 1 raise ValueError