Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix type object signature when both __new__ and __init__ present #5642
Currently mypy will prefer
referenced this pull request
Sep 19, 2018
Note that only the first example fails in CPython -- the others are OK.
The rule CPython uses is this (for a class
C with superclass
B is not
- If both
C.__init__refer to their versions in
object, the signature is
def () -> C.
- If exactly one of
C.__object__refers to its
objectversion, the other determines the signature.
- If both override their corresponding
objectversions, they must match -- even if they don't come from the same class (say, if one comes from
Cand the other from