Description
Bug description
The used-before-assignment
check reports false positive for using the same variable inside multiple if __name__ == '__main__'
statements.
# pylint: disable=missing-docstring
if __name__ == '__main__':
X = 1
if __name__ == '__main__':
print(X)
Configuration
No response
Command used
pylint test.py
Pylint output
************* Module test
test.py:7:10: E0601: Using variable 'X' before assignment (used-before-assignment)
-----------------------------------
Your code has been rated at 0.00/10
Expected behavior
No error.
Pylint version
pylint 2.16.0
astroid 2.14.1
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
OS / Environment
No response
Additional dependencies
No response