An example of a try/except where pylint does not detect UnboundLocalError (used-before-assignment) #5811
Labels
Duplicate 🐫
Duplicate of an already existing issue
Milestone
Bug description
This is related to (but not exactly duplicated by) what is described in #4913 and #4045 .
Here is an example where a variable is initialized inside a try block, and is used in the except, before it had a chance to be initialized.
if i run this code, i get an error -- as i would expect.
however, pylint doesn't see a problem with the code:
Configuration
No response
Command used
Pylint output
Expected behavior
I would expect pylint to report
used-before-assignment
in the line in the except block where we use the variable that was never initialized:Pylint version
OS / Environment
Mac OS Monteray 12.2 (21D49)
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: