-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Labels
Blocker 🙅Blocks the next releaseBlocks the next releaseC: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkControl flowRequires control flow understandingRequires control flow understandingFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeHigh priorityIssue with more than 10 reactionsIssue with more than 10 reactionsNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Milestone
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
Metadata
Metadata
Assignees
Labels
Blocker 🙅Blocks the next releaseBlocks the next releaseC: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkControl flowRequires control flow understandingRequires control flow understandingFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeHigh priorityIssue with more than 10 reactionsIssue with more than 10 reactionsNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation