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

1.7.0 Broken explicit-override for pydantic 1.10 #16548

Closed
zoola969 opened this issue Nov 23, 2023 · 3 comments
Closed

1.7.0 Broken explicit-override for pydantic 1.10 #16548

zoola969 opened this issue Nov 23, 2023 · 3 comments
Labels
bug mypy got something wrong topic-inheritance Inheritance and incompatible overrides

Comments

@zoola969
Copy link

Bug Report

After updating mypy from 1.6.1 to 1.7.0 I faced the issue with explicit-override option for pydantic models

To Reproduce
example.py

from pydantic import BaseModel

class M(BaseModel):
    a: int

Expected Behavior

No errors

Actual Behavior
mypy --enable-error-code explicit-override example.py

error: Method "__mypy-replace" is not using @override but is overriding a method in class "pydantic.main.BaseModel" [explicit-override]

Your Environment

  • Mypy version used: 1.7.0
  • Pydantic version used: 1.10.13
  • Mypy command-line flags: --enable-error-code explicit-override
  • Python version used: 3.11
@zoola969 zoola969 added the bug mypy got something wrong label Nov 23, 2023
@AlexWaygood
Copy link
Member

Looks like the same basic thing as #16454; it's possible @ikonst's PR #16524 would also fix this issue

@AlexWaygood AlexWaygood added the topic-inheritance Inheritance and incompatible overrides label Nov 23, 2023
@ikonst
Copy link
Contributor

ikonst commented Nov 23, 2023

It's probably a dup of #16452. My PR might address it inadvertently but the real fix is not to check overrides in private attributes since they're by definition not overriding.

@zoola969
Copy link
Author

Works fine in 1.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-inheritance Inheritance and incompatible overrides
Projects
None yet
Development

No branches or pull requests

3 participants