-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
featuregood-first-issuetopic-runtime-semanticsmypy doesn't model runtime semantics correctlymypy doesn't model runtime semantics correctly
Description
Feature
continue/break/return in except* is a syntax error, see https://peps.python.org/pep-0654/#forbidden-combinations.
def foo():
for _ in range(5):
try:
...
except* Exception:
continue
except* ValueError:
break
except* TypeError:
return
$ mypy --python-version=3.11 foo.py
Success: no issues found in 1 source file
$ mypy --version
mypy 1.13.0 (compiled: yes)
Pitch
mypy does give an error if you try to combine except
and except*
, and as far as I know it flags all other syntax errors as well, so should probably handle this too. It might also cause users to adjust code to avoid unreachable code
needlessly, when in fact they have bigger problems to fix first.
brianschubert and Zac-HD
Metadata
Metadata
Assignees
Labels
featuregood-first-issuetopic-runtime-semanticsmypy doesn't model runtime semantics correctlymypy doesn't model runtime semantics correctly