#29970: Cannot use cached_property instance without calling __set_name__() on 
it.
-------------------------------------------+------------------------
               Reporter:  Collin Anderson  |          Owner:  nobody
                   Type:  Bug              |         Status:  new
              Component:  Utilities        |        Version:  master
               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                |
-------------------------------------------+------------------------
 With Python 3.6.7 (on Ubuntu 18.04), I'm getting this error for a fairly
 standard use of `cached_property`:

 `TypeError: Cannot use cached_property instance without calling
 __set_name__() on it.`

 {{{
 class MyModel(models.Model):
     @cached_property
     def my_method(self):
         return 'test'
 }}}

 I assume this was broken by #29478. Maybe Django's custom `__new__` code
 for models breaks the `__set_name__` hook?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29970>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/057.4edfb9ee345844d93450b3123e7789a9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to