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
The classproperty decorator, when used to override a superclass property, fails with an error of Signature of <property> incompatible with supertype <Superclass>; I thought this was related to this issue in mypy, but mypy 1.0.0 has been released with this issue fixed and yet this specific case does not work properly.
fromtypingimportreveal_typefromdjango.utils.functionalimportclasspropertyclassSuperclass:
prop=3classSubclass(Superclass):
@classpropertydefprop(self) ->int:
return6reveal_type(Subclass.prop) # Runtime type is 'int', as expected# Mypy fails with "error: Signature of 'prop' incompatible with supertype 'Superclass'"
How is that should be
Mypy should correctly identify that prop works as a property and returns an int, being compatible with the superclass.
System information
OS: Windows
python version: 3.11.1
django version: 4.1.17
mypy version: 1.0.0
django-stubs version: 1.14.0
django-stubs-ext version: 0.7.0
The text was updated successfully, but these errors were encountered:
Bug report
What's wrong
The
classproperty
decorator, when used to override a superclass property, fails with an error ofSignature of <property> incompatible with supertype <Superclass>
; I thought this was related to this issue in mypy, but mypy 1.0.0 has been released with this issue fixed and yet this specific case does not work properly.How is that should be
Mypy should correctly identify that prop works as a property and returns an int, being compatible with the superclass.
System information
python
version: 3.11.1django
version: 4.1.17mypy
version: 1.0.0django-stubs
version: 1.14.0django-stubs-ext
version: 0.7.0The text was updated successfully, but these errors were encountered: