Closed
Description
Bug Report
x: int
print(x)
Mypy does not report an error for the code above or for this code:
print(x)
x = 0
But reports:
error: Name "x" is not defined
for:
print(x)
At runtime Python reports:
NameError: name 'x' is not defined
in all three cases.
Expected Behavior
Mypy should report Name "x" is not defined
in all three cases.
Your Environment
- Mypy version used: 0.910
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini
(and other config files): none - Python version used: Python 3.9.5 (default, Jul 19 2021, 01:21:38)
- Operating system and version: Ubuntu 16.04