-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeHigh effort 🏋Difficult solution or problem to solveDifficult solution or problem to solveNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Description
Bug description
# pylint: disable=missing-module-docstring,invalid-name
a = bool(input())
b = bool(input())
if a:
c = 123
if a and b:
print(c) # report possibly-used-before-assignment
if a:
c += 1 # ok
Configuration
No response
Command used
pylint bug.py
Pylint output
************* Module bug
bug.py:9:10: E0601: Using variable 'c' before assignment (used-before-assignment)
------------------------------------------------------------------
Your code has been rated at 3.75/10 (previous run: 3.75/10, +0.00)
Expected behavior
No errors
Pylint version
pylint 3.2.2
astroid 3.2.2
Python 3.11.3+ (heads/3.11:9fbb614c4e, Apr 29 2023, 14:18:05) [GCC 10.2.1 20210110]
OS / Environment
No response
Additional dependencies
No response
jpl-dhemberg
Metadata
Metadata
Assignees
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeHigh effort 🏋Difficult solution or problem to solveDifficult solution or problem to solveNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation