#30278: Using del on uncalled cached_property throws exception.
-------------------------------------+-------------------------------------
               Reporter:  Matthew    |          Owner:  nobody
  Schinckel                          |
                   Type:  Bug        |         Status:  new
              Component:  Utilities  |        Version:  master
               Severity:  Normal     |       Keywords:  cached_property
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 It's explicitly documented that you may use `del` (or `delattr`) to force
 a cached_property to recalculate the next time it's called.

 However, if you try to `del` a cached_property that has never been
 evaluated, then an AttributeError is raised.

 There doesn't seem to be a way to detect if a cached_property has been
 evaluated or not, as `hasattr(foo, 'bar')` results in the evaluation of
 the cached_property.

 It's entirely possible that this is something that is beyond the
 capability of the way cached_property is implemented, but it still feels
 wrong to me.

 (Likewise, if you attempt to `del foo.bar` twice without evaluation in
 between, you will raise an AttributeError).

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30278>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.d3aa367c960c030b2c22409c96689e2d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to