We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1938d5e commit 46d73d8Copy full SHA for 46d73d8
astroid/rebuilder.py
@@ -1381,7 +1381,7 @@ def _find_orelse_keyword(
1381
start = node.orelse[0].lineno
1382
1383
# pylint: disable-next=unsubscriptable-object
1384
- for index, line in enumerate(self._data[start::-1]):
+ for index, line in enumerate(self._data[start:node.lineno:-1]):
1385
if line.rstrip().startswith("else"):
1386
return start - index + 1, line.index("else")
1387
if line.rstrip().startswith("elif"):
0 commit comments