-
-
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
Do not block on duplicate base classes #15367
Conversation
This comment has been minimized.
This comment has been minimized.
test-data/unit/check-classes.test
Outdated
... | ||
|
||
b: B | ||
# We use dummy type info, so no real attrs will be there: |
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.
That's pretty unfortunate, can we make it inherit from Any or just skip the duplicate base instead?
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.
Yeap, got it. Fixed!
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.
This looks good to me!
One possible improvement here could be to deduplicate the base classes when calculating MRO, so instead of Any MRO we still get the MRO as if the base class was unduplicated.
@hauntsaninja I don't fill comfortable doing this. Because we can have two generic bases: |
Okay! I went ahead and added a test case for that situation |
Diff from mypy_primer, showing the effect of this PR on open source code: vision (https://github.com/pytorch/vision) got 1.36x slower (40.8s -> 55.5s)
|
@JelleZijlstra I don't really have a prefence on this issue. I am fine with both blocking and non-blocking errors here.
But, it looks like that making this non-blocking is quite straight-forward.
Closes #15349