-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix attribute type resolution with multiple inheritance #18415
Fix attribute type resolution with multiple inheritance #18415
Conversation
…llowing bases needn't be compatible
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, will leave for Ivan but had small comment
pass | ||
|
||
class D(D0,D1,C): | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we expect an error for something like:
class D3(D0,D1,C):
class M(A.M):
pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We certainly should expect an error there as such an override violates LSP. But overrides are checked elsewhere, I'm only modifying inherited attributes compatibility checks in this PR.
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Diff from mypy_primer, showing the effect of this PR on open source code: xarray (https://github.com/pydata/xarray)
+ xarray/core/groupby.py:1610: error: Unused "type: ignore" comment [unused-ignore]
+ xarray/core/groupby.py:1778: error: Unused "type: ignore" comment [unused-ignore]
+ xarray/core/resample.py:236: error: Unused "type: ignore" comment [unused-ignore]
+ xarray/core/resample.py:379: error: Unused "type: ignore" comment [unused-ignore]
ibis (https://github.com/ibis-project/ibis)
- ibis/common/collections.py:280: error: Definition of "get" in base class "Mapping" is incompatible with definition in base class "Mapping" [misc]
|
Fixes #18268. Fixes #9319. Fixes #14279. Fixes #9031.
Supersedes #18270 as requested by @ilevkivskyi.
This PR introduces two changes:
map_type_from_supertype
when checking generic attributes