New semanal: Spurious "no binding for nonlocal" #7057
Labels
bug
mypy got something wrong
false-positive
mypy gave an error on correct code
priority-1-normal
semantic-analyzer
Problems that happen during semantic analysis
topic-runtime-semantics
mypy doesn't model runtime semantics correctly
topic-variable-scope
This code passes under the old semantic analyzer. The error goes away if I move the
running = True
line above the definition of the nested function.It doesn't seem unreasonable to me to require that the definition of a variable is lexically before its use as a nonlocal, so maybe this doesn't need to be fixed.
The text was updated successfully, but these errors were encountered: