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
{{ message }}
Repository navigation
Check the type of the first argument of the function enclosing super() #3931
classB:
x=1classC(B):
defmeth(self) ->None:
definner(x: int) ->None:
reveal_type(super().x) # Revealed type is 'builtins.int'inner(42)
C().meth()
This passes type check, but fails at runtime with a scary error. An additional problem is that mypy requires to put an argument in inner, but then it looks like mypy completely ignores it. This seem to be a bug in analyze_super, the code in this function is a bit hard to follow and might be worth refactoring.
Activity
ilevkivskyi commentedon Sep 6, 2017
This is a follow up for #3919
ilevkivskyi commentedon Aug 27, 2019
I think this can be closed now. Although error message that mypy now gives is IMO still not perfect, it is very similar to the runtime error: