#33191: Avoid unnecessary clear of cached reference
-------------------------------------+-------------------------------------
     Reporter:  Barry Johnson        |                    Owner:  nobody
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  3.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

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


Comment:

 Hi Barry. Thanks for the report.

 For me, this is just how things are expected to work, so I'm going to say
 wontfix. I'm happy if you want to take it to the DevelopersMailingList for
 a wider discussion, but (in general) I'm suspicious of a ''"simple
 change"'' adjusting a long-standing behaviour like this… (Perhaps there's
 a case to be made on the mailing list though.)

 To address the example, my first thought is that you should be saving
 `parent` before creating child:

 {{{
 parent = Parent(name='parent_object')
 parent.save()
 child = Child(parent=parent)
 ...
 }}}

 My second is that, you have `parent`, so print the name from there:

 {{{
 print(parent.name)
 }}}

 I appreciate you've no-doubt reduced this in order to show the issue more
 clearly than in a real example, but I'd suspect those thoughts would go
 back to the more realistic case.

 However, as I say, the DevelopersMailingList is a better venue to pursue
 this kind of thing.
 Thanks.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33191#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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.c5db265f107fcf09b14d4349f6f6ea35%40djangoproject.com.

Reply via email to