int.__new__ needs a stub #2686
Copy link
Copy link
Closed
Labels
stubs: incompleteAnnotations or sub-modules missing from an existing package or moduleAnnotations or sub-modules missing from an existing package or module
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
stubs: incompleteAnnotations or sub-modules missing from an existing package or moduleAnnotations or sub-modules missing from an existing package or module
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