You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes there's a need to use a typing.Protocol to specify self typing for cases like mixin classes, where the methods aren't there at class definition, but will be there at runtime, once the mixin is inherited from. This generally works fine, except it breaks in one silly case, a short repro of which is available below.
In short, it looks like super doesn't like protocols as it's second argument, which isn't even explicitly passed here.
Fixes#12344
FWIW this is unsafe (since we don't know where the mixin will appear in
the MRO of the actual implementation), but the alternative is having
annoying false positives like this issue and e.g.
#4335
Bug Report
Sometimes there's a need to use a
typing.Protocol
to specifyself
typing for cases like mixin classes, where the methods aren't there at class definition, but will be there at runtime, once the mixin is inherited from. This generally works fine, except it breaks in one silly case, a short repro of which is available below.In short, it looks like
super
doesn't like protocols as it's second argument, which isn't even explicitly passed here.To Reproduce
Expected Behavior
No error, duh.
Actual Behavior
From the very last line of the code above:
Your Environment
mypy.ini
(and other config files): noneThe text was updated successfully, but these errors were encountered: