Skip to content

A004 Preview Mode ExceptionGroup import in pre-3.11 #13037

@CoolCat467

Description

@CoolCat467

Getting A004 Import BaseExceptionGroup is shadowing a Python builtin and ExceptionGroup errors raised in this case:

if sys.version_info < (3, 11):
    from exceptiongroup import BaseExceptionGroup, ExceptionGroup

I would argue that this should not be the case. BaseExceptionGroup and ExceptionGroup do not exist in python versions prior to 3.11, and using the exceptiongroup package is commonly used for backwards compatibility.

Using ruff preview mode v0.6.1

Metadata

Metadata

Assignees

Labels

acceptedReady for implementationpreviewRelated to preview mode featuresruleImplementing or modifying a lint rule

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions