#33415: @classproperty breakes @abc.abstractmethod
--------------------------------------+------------------------
               Reporter:  Behoston    |          Owner:  nobody
                   Type:  Bug         |         Status:  new
              Component:  Utilities   |        Version:  4.0
               Severity:  Normal      |       Keywords:
           Triage Stage:  Unreviewed  |      Has patch:  0
    Needs documentation:  0           |    Needs tests:  0
Patch needs improvement:  0           |  Easy pickings:  0
                  UI/UX:  0           |
--------------------------------------+------------------------
 I'm trying to do something weird,  but I found an interesting bug:


 {{{
 #!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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.ab7e99c22f9ef49f285b9db4cf443e9a%40djangoproject.com.

Reply via email to