{{{
#!div style="font-size: 100%"
Example:
{{{#!python
import abc
import inspect
from django.utils.functional import classproperty
class A(metaclass=abc.ABCMeta):
@classproperty
@abc.abstractmethod
def x(self):
pass
print(inspect.isabstract(A)) # False
}}}
}}}
This prints False. It should print True, due to method x is not
implemented.
It works a little bit better when @abc.abstractmethod is first
decorator. Then class is recoginsed as abstract. However, subclass of this
class is always not-abstract.
{{{
#!div style="font-size: 100%"
Example:
{{{#!python
import abc
import inspect
from django.utils.functional import classproperty
class A(metaclass=abc.ABCMeta):
@abc.abstractmethod
@classproperty
def x(self):
pass
class B(A, metaclass=abc.ABCMeta):
pass
print(inspect.isabstract(A)) # True
print(inspect.isabstract(B)) # False
}}}
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33415>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => needsinfo
Comment:
Other decorators also break `isabstract()`, e.g. `@cached_property`. I'm
not sure how to fix it and is it worth additional complexity. Can you
provide PoC?
--
Ticket URL: <https://code.djangoproject.com/ticket/33415#comment:1>