-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
bugSomething isn't workingSomething isn't workingpreviewRelated to preview mode featuresRelated to preview mode featuresruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
Summary
stop-iteration-return (PLR1708) reports false positives when a non-generator function raises StopIteration and contains a nested generator function, or a generator function contains a nested non-generator function that raises StopIteration. Example:
$ cat >plr1708.py <<'# EOF'
def f():
def g():
yield 1
raise StopIteration
def g():
def f():
raise StopIteration
yield 1
# EOF
$ ruff --isolated check plr1708.py --select PLR1708 --preview --output-format concise -q
plr1708.py:4:5: PLR1708 Explicit `raise StopIteration` in generator
plr1708.py:8:9: PLR1708 Explicit `raise StopIteration` in generatorVersion
ruff 0.14.3 (8737a2d 2025-10-30)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpreviewRelated to preview mode featuresRelated to preview mode featuresruleImplementing or modifying a lint ruleImplementing or modifying a lint rule