[Django] #29478: cached_property decorator doesn't work with mangled method names

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django] #29478: cached_property decorator doesn't work with mangled method names

Django
#29478: cached_property decorator doesn't work with mangled method names
-------------------------------------------+------------------------
               Reporter:  Thomas Grainger  |          Owner:  nobody
                   Type:  Uncategorized    |         Status:  new
              Component:  Uncategorized    |        Version:  2.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                |
-------------------------------------------+------------------------
 {{{
 import itertools

 from django.utils.functional import cached_property

 count = itertools.count()
 count2 = itertools.count()
 count3 = itertools.count()


 class Foo:
     @cached_property
     def __foo(self):
         return next(count)

     @cached_property
     def foo2(self):
         return next(count2)

     @property
     def foo3(self):
         return next(count3)

     def run(self):
         print('foo', self.__foo)
         print('foo', self.__foo)
         print('foo', self.__foo)
         print('foo', self.__foo)
         print('foo2', self.foo2)
         print('foo2', self.foo2)
         print('foo2', self.foo2)
         print('foo2', self.foo2)
         print('foo2', self.foo2)
         print('foo3', self.foo3)
         print('foo3', self.foo3)
         print('foo3', self.foo3)
         print('foo3', self.foo3)
         print('foo3', self.foo3)


 Foo().run()


 """
 python cached_property_test.py
 foo 0
 foo 1
 foo 2
 foo 3
 foo2 0
 foo2 0
 foo2 0
 foo2 0
 foo2 0
 foo3 0
 foo3 1
 foo3 2
 foo3 3
 foo3 4
 """
 }}}


 Odd it's not been reported before:
 https://code.djangoproject.com/search?q=cached_property+mangled

--
Ticket URL: <https://code.djangoproject.com/ticket/29478>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/052.c8be32cefcdc0046857ed6d36785cad5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29478: cached_property decorator doesn't work with mangled method names

Django
#29478: cached_property decorator doesn't work with mangled method names
---------------------------------+------------------------------------
     Reporter:  Thomas Grainger  |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Utilities        |                  Version:  2.0
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  1
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------
Changes (by Tim Graham):

 * component:  Uncategorized => Utilities
 * needs_better_patch:  0 => 1
 * has_patch:  0 => 1
 * type:  Uncategorized => Bug
 * stage:  Unreviewed => Accepted


Comment:

 [https://github.com/django/django/pull/10033 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/29478#comment:1>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.cb14c07415d09fae55c9b24a62a1d66a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29478: cached_property decorator doesn't work with mangled method names

Django
In reply to this post by Django
#29478: cached_property decorator doesn't work with mangled method names
---------------------------------+------------------------------------
     Reporter:  Thomas Grainger  |                    Owner:  hehaha
         Type:  Bug              |                   Status:  assigned
    Component:  Utilities        |                  Version:  2.0
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  1
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------
Changes (by hehaha):

 * status:  new => assigned
 * owner:  nobody => hehaha


--
Ticket URL: <https://code.djangoproject.com/ticket/29478#comment:2>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.716a0fa9373b3923f4c0b26af10e886e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29478: cached_property decorator doesn't work with mangled method names

Django
In reply to this post by Django
#29478: cached_property decorator doesn't work with mangled method names
---------------------------------+------------------------------------
     Reporter:  Thomas Grainger  |                    Owner:  (none)
         Type:  Bug              |                   Status:  new
    Component:  Utilities        |                  Version:  2.0
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  1
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------
Changes (by Xin He):

 * status:  assigned => new
 * owner:  Xin He => (none)


Comment:

 It's seem another pull request to fix the ticket on Github. So I have to
 deassign it.

--
Ticket URL: <https://code.djangoproject.com/ticket/29478#comment:3>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.3632a03c263a7d09b97d687b7970cb1a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29478: cached_property decorator doesn't work with mangled method names

Django
In reply to this post by Django
#29478: cached_property decorator doesn't work with mangled method names
---------------------------------+------------------------------------
     Reporter:  Thomas Grainger  |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Utilities        |                  Version:  2.0
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  1
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------

Comment (by Harro):

 Had a look at this, and the Foo instance dict does contain the __foo (and
 the foo2, but not the foo3 as expected).

 I think this is more a python thing where the double underscore is special
 and that is the reason it doesn't work and that it has nothing to do with
 the @cached_property decorator.

--
Ticket URL: <https://code.djangoproject.com/ticket/29478#comment:2>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.cda93364cd9469db39d285b0bce83261%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29478: cached_property decorator doesn't work with mangled method names

Django
In reply to this post by Django
#29478: cached_property decorator doesn't work with mangled method names
---------------------------------+------------------------------------
     Reporter:  Thomas Grainger  |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Utilities        |                  Version:  2.0
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------
Changes (by Thomas Grainger):

 * needs_better_patch:  1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/29478#comment:3>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.50b994f5fd33817c2887590049d30643%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29478: cached_property decorator doesn't work with mangled method names

Django
In reply to this post by Django
#29478: cached_property decorator doesn't work with mangled method names
---------------------------------+------------------------------------
     Reporter:  Thomas Grainger  |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Utilities        |                  Version:  2.0
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

 In [changeset:"09199734d383691ecf6d163894b447ca45e0ef82" 09199734]:
 {{{
 #!CommitTicketReference repository=""
 revision="09199734d383691ecf6d163894b447ca45e0ef82"
 Refs #29478 -- Doc'd how to use cached_property with a mangled name.
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29478#comment:4>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.e0298678913a6a7f9f65f1399ca2f028%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29478: cached_property decorator doesn't work with mangled method names

Django
In reply to this post by Django
#29478: cached_property decorator doesn't work with mangled method names
---------------------------------+------------------------------------
     Reporter:  Thomas Grainger  |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Utilities        |                  Version:  2.0
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

 In [changeset:"2a637a45232fa5f046034958a6df91804bbab32c" 2a637a45]:
 {{{
 #!CommitTicketReference repository=""
 revision="2a637a45232fa5f046034958a6df91804bbab32c"
 [2.1.x] Refs #29478 -- Doc'd how to use cached_property with a mangled
 name.

 Backport of 09199734d383691ecf6d163894b447ca45e0ef82 from master
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29478#comment:5>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.cdf60d72eeed849c916edf988097da3f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29478: cached_property decorator doesn't work with mangled method names

Django
In reply to this post by Django
#29478: cached_property decorator doesn't work with mangled method names
---------------------------------+------------------------------------
     Reporter:  Thomas Grainger  |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Utilities        |                  Version:  2.0
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  1
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------
Changes (by Tim Graham):

 * needs_better_patch:  0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/29478#comment:6>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.f11675662fcf565cb57e50f5ed70358e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29478: cached_property decorator doesn't work with mangled method names

Django
In reply to this post by Django
#29478: cached_property decorator doesn't work with mangled method names
---------------------------------+------------------------------------
     Reporter:  Thomas Grainger  |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Utilities        |                  Version:  2.0
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------
Changes (by Tim Graham):

 * needs_better_patch:  1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/29478#comment:7>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.12d803ea4e81af779357a9185315076e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29478: cached_property decorator doesn't work with mangled method names

Django
In reply to this post by Django
#29478: cached_property decorator doesn't work with mangled method names
---------------------------------+------------------------------------
     Reporter:  Thomas Grainger  |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Utilities        |                  Version:  2.0
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------
Changes (by Sergey Fedoseev):

 * needs_better_patch:  1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/29478#comment:7>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.9f8cfc1f982fa579f38f1a574fba811a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29478: cached_property decorator doesn't work with mangled method names

Django
In reply to this post by Django
#29478: cached_property decorator doesn't work with mangled method names
---------------------------------+------------------------------------
     Reporter:  Thomas Grainger  |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Utilities        |                  Version:  2.0
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

 In [changeset:"80ba7a881f9810404ba8a660548f1757f8243562" 80ba7a8]:
 {{{
 #!CommitTicketReference repository=""
 revision="80ba7a881f9810404ba8a660548f1757f8243562"
 Fixed cached_properties that share a common property.

 The aliases aren't cached and thus the old usage will be an error after
 refs #29478.
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29478#comment:8>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.0bfcb2b2dce0a47c85548e711fe4afcb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29478: cached_property decorator doesn't work with mangled method names

Django
In reply to this post by Django
#29478: cached_property decorator doesn't work with mangled method names
---------------------------------+------------------------------------
     Reporter:  Thomas Grainger  |                    Owner:  nobody
         Type:  Bug              |                   Status:  closed
    Component:  Utilities        |                  Version:  2.0
     Severity:  Normal           |               Resolution:  fixed
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"06076999026091cf007d8ea69146340a361259f8" 06076999]:
 {{{
 #!CommitTicketReference repository=""
 revision="06076999026091cf007d8ea69146340a361259f8"
 Fixed #29478 -- Added support for mangled names to cached_property.

 Co-Authored-By: Sergey Fedoseev <[hidden email]>
 }}}

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