You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm seeing a false positive for no-member when there are two exception blocks that reuse the exception name. Here is the code block that is triggering the false positive:
************* Module test_pylint
Core\test_pylint.py:13:24: E1101: Instance of 'ValueError' has no 'strerror' member (no-member)
I understand that open() may never raise a ValueError, I just used it to demonstrate the issue.
Steps to reproduce
Create two separate and sequential try...except blocks that catch different exceptions. The secondtry...except must reference a member in the exception that is not available in the first exception (see above example code)
Run pylint
See there is a false positive for no-member on the second exception block.
Current behavior
There is a no-member error on the second exception block.
Expected behavior
pylint properly detects that the second exception block catches a different exception type and there is no no-member false positives.
pylint --version output
pylint 2.3.1
astroid 2.2.2
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
The text was updated successfully, but these errors were encountered:
Thanks for reporting an issue. This is similar to #2777 so I'm going to close this one. What's happening is described in my comment here, basically we infer e as both OSerror and ValueError, even though e is bound in that except handler as OSError.
I'm seeing a false positive for
no-member
when there are two exception blocks that reuse the exception name. Here is the code block that is triggering the false positive:The error pylint is reporting:
I understand that
open()
may never raise aValueError
, I just used it to demonstrate the issue.Steps to reproduce
try...except
blocks that catch different exceptions. The secondtry...except
must reference a member in the exception that is not available in the first exception (see above example code)no-member
on the second exception block.Current behavior
There is a
no-member
error on the second exception block.Expected behavior
pylint properly detects that the second exception block catches a different exception type and there is no
no-member
false positives.pylint --version output
The text was updated successfully, but these errors were encountered: