-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
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.
- The class
WeakMethodinweakref.pyidefines a__new__that is incompatible with the__init__declared in its parent classReferenceType. - The class
_TokenTypeinpygments/token.pyidefines an__init__that is incompatible with the__new__intuple[str]. - The class
CascadeOptionsinSQLAlchemy/sqlalchemy/orm/util.pyidefines 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.
Metadata
Metadata
Assignees
Labels
No labels