Regression: used-before-assignment error not reported for function arguments #2374
Labels
C: used-before-assignment
Issues related to 'used-before-assignment' check
False Negative 🦋
No message is emitted but something is wrong with the code
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
Regression
Milestone
Steps to reproduce
Run Pylint on the following code:
Current behavior:
No warning or error is reported.
However, the code fails to run because of this well-known issue with using variables considered as local before their assignment. The following exception is raised:
Expected behavior
used-before-assignment
error is reported on line wheretmp
is first used in functioninner
.This error is correctly reported by Pylint 1.9.3, but not by Pylint versions 2 and above.
A similar error is correctly reported by Pylint versions 2 and above when the
tmp
variable is locally defined within the outer function, but not when it is a function's argument.pylint --version output
pylint 2.1.0
astroid 2.0.2
Python 3.6.6 (default, Jun 27 2018, 14:44:17)
[GCC 8.1.0]
(the current master branch version 7be00a9)
The text was updated successfully, but these errors were encountered: