-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Inconsistencies between __init__
and __new__
#6905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
For problem 2, I think we should just delete The implementation is:
|
Sounds like a good plan. |
Relatedly (but slightly tangentially), can anybody explain to me why Lines 117 to 118 in 5d20635
(Same issue for |
I just implemented a new check in pyright called
reportInconsistentConstructor
that detects inconsistencies between the__init__
and__new__
methods. It's disabled by default but can be enabled in the configuration. It's in pyright 1.1.207, which I just published.The check is pretty conservative, but it does identify three places in typeshed that look like legitimate problems.
WeakMethod
inweakref.pyi
defines a__new__
that is incompatible with the__init__
declared in its parent classReferenceType
._TokenType
inpygments/token.pyi
defines an__init__
that is incompatible with the__new__
intuple[str]
.CascadeOptions
inSQLAlchemy/sqlalchemy/orm/util.pyi
defines a__new__
that is incompatible with the__init__
in its parent classfrozenset[Any]
.If/when these are addressed, we might want to update pyright to 1.1.207 and enable the new diagnostic check to prevent future inconsistencies from being introduced.
The text was updated successfully, but these errors were encountered: