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

__match_args__ and overrides #12008

Closed
JelleZijlstra opened this issue Jan 18, 2022 · 0 comments · Fixed by #12411
Closed

__match_args__ and overrides #12008

JelleZijlstra opened this issue Jan 18, 2022 · 0 comments · Fixed by #12411
Labels
bug mypy got something wrong priority-0-high topic-match-statement Python 3.10's match statement

Comments

@JelleZijlstra
Copy link
Member

#10191 introduced a new false positive:

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/profile.py:204: error: Cannot override final attribute "__match_args__" (previously declared in base class "EquippedProfileItems")  [misc]
+ steam/profile.py:204: error: Cannot override writable attribute "__match_args__" with a final one  [misc]
+ steam/profile.py:204: error: Definition of "__match_args__" in base class "ProfileInfo" is incompatible with definition in base class "EquippedProfileItems"  [misc]

Some further discussion in #10191 (comment).

I think we should just always allow overriding __match_args__, because it's only looked up on concrete classes, so overriding it is always safe.

@JelleZijlstra JelleZijlstra added bug mypy got something wrong topic-match-statement Python 3.10's match statement labels Jan 18, 2022
JukkaL added a commit that referenced this issue Mar 21, 2022
…sses

Multiple inheritance from dataclasses and attrs classes works at runtime,
so don't complain about `__match_args__` or `__attrs_attrs__` which tend
to have incompatible types in subclasses.

Fixes #12349. Fixes #12008. Fixes #12065.
dcermak added a commit to dcermak/pytest_container that referenced this issue Mar 22, 2022
JukkaL added a commit that referenced this issue Mar 22, 2022
Multiple inheritance from dataclasses and attrs classes works at runtime,
so don't complain about `__match_args__` or `__attrs_attrs__` which tend
to have incompatible types in subclasses.

Fixes #12349. Fixes #12008. Fixes #12065.
JukkaL added a commit that referenced this issue Mar 23, 2022
Multiple inheritance from dataclasses and attrs classes works at runtime,
so don't complain about `__match_args__` or `__attrs_attrs__` which tend
to have incompatible types in subclasses.

Fixes #12349. Fixes #12008. Fixes #12065.
dcermak added a commit to dcermak/pytest_container that referenced this issue Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong priority-0-high topic-match-statement Python 3.10's match statement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants