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
It seems that int doesn't have a method stub for __new__, which causes mypy to complain on code that attempts to subclass int. Unfortunately, I'm not sure exactly how to write this stub. If someone can give me some guidance, I can try to write a pull request.
Reacted by Nicholas A. Del Grosso and Dominic Davis-Foster
So I guess it's not possible to add a stub for int.__new__ without breaking other things? Does this mean I just need to use # type: ignore on the call to super(...).__new__() when subclassing int?
Activity
sproshev commentedon Dec 12, 2018
int.__new__had been added in #1352 but then reverted in #1464DarwinAwardWinner commentedon Dec 12, 2018
So I guess it's not possible to add a stub for
int.__new__without breaking other things? Does this mean I just need to use# type: ignoreon the call tosuper(...).__new__()when subclassing int?Bhargavasomu commentedon Jan 14, 2019
I am experiencing the same issue with
bytestoo.sproshev commentedon Jan 14, 2019
@Bhargavasomu see #2630
Use __new__ instead of __init__ for some builtin classes
Use __new__ instead of __init__ for some builtin classes (#4555)
hauntsaninja commentedon Sep 30, 2020
Closed by #4555