Open afrieder opened 7 years ago
x: int = 5 if True: global x x += 1
passes mypy, but raises a syntax error when run: SyntaxError: annotated name 'x' can't be global
SyntaxError: annotated name 'x' can't be global
Similar things happen with nonlocal in the proper context.
nonlocal
This looks like a mypy bug. Thanks for reporting this!
Indeed, the syntax error is specified PEP 526.
passes mypy, but raises a syntax error when run:
SyntaxError: annotated name 'x' can't be global
Similar things happen with
nonlocal
in the proper context.