Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catching multiple exceptions causes multiple false-positives #2841

Closed
tucked opened this issue Mar 27, 2019 · 1 comment
Closed

Catching multiple exceptions causes multiple false-positives #2841

tucked opened this issue Mar 27, 2019 · 1 comment

Comments

@tucked
Copy link

tucked commented Mar 27, 2019

This is essentially a reopen of #1756 and #2431 (with a false-positive E1101 in between).

Steps to reproduce

"""example.py"""


def _foobar():
    exceptions = tuple([ValueError, TypeError])
    try:
        raise ValueError
    except exceptions as exc:
        print(exc.message)
        raise exc

Current behavior

$ pylint example.py
************* Module example
example.py:8:11: E0712: Catching an exception which doesn't inherit from Exception: exceptions (catching-non-exception)
example.py:9:14: E1101: Instance of 'tuple' has no 'message' member (no-member)
example.py:10:8: E0710: Raising a new style class which doesn't inherit from BaseException (raising-non-exception)

----------------------------------------------------------------------
Your code has been rated at -11.43/10 (previous run: -11.43/10, +0.00)

Expected behavior

No errors

pylint --version output

pylint 2.3.1
astroid 2.2.5
Python 3.7.1 (default, Nov  6 2018, 20:20:54)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
@PCManticore
Copy link
Contributor

Hey @tucked Thanks for opening an issue. This should be fixed now in the astroid's master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants