Skip to content

B030 doesn't allow splatted exceptions #352

Closed
@samueljsb

Description

@samueljsb

I think there's a false-report coming from B030 where we have some exceptions types defined in a constant. A minimal example:

EXCEPTIONS_TO_IGNORE = (
    ValueError,
    TypeError,
)

try:
    pass
except (SyntaxError, *EXCEPTIONS_TO_IGNORE):
    pass
$ flake8 t.py
t.py:8:1: B030 Except handlers should only be names of exception classes

This isn't incorrect, so I don't think the intention of B030 is to stop this kind of thing.

versions etc

I'm using Macos 13.1, we're also seeing this in CI using Ubuntu 20.04.5.

$ python --version --version
Python 3.10.8 (main, Oct 13 2022, 10:17:43) [Clang 14.0.0 (clang-1400.0.29.102)]

$ flake8 --version
6.0.0 (flake8-bugbear: 23.2.13, mccabe: 0.7.0, pycodestyle: 2.10.0, pyflakes: 3.0.1) CPython 3.10.8 on Darwin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions