#23492: F objects are no longer deepcopy-able
-------------------------------------+-------------------------------------
     Reporter:  ris                  |      Owner:  nobody
         Type:  Bug                  |     Status:  new
    Component:  Database layer       |    Version:  1.7
  (models, ORM)                      |   Keywords:  F object expression
     Severity:  Normal               |  deepcopy
 Triage Stage:  Unreviewed           |  Has patch:  0
Easy pickings:  1                    |      UI/UX:  0
-------------------------------------+-------------------------------------
 I suspect the culprit is commit 3a66035107a640c4905f0a5f247a45f32dbe16d7
 "Removed F.__deepcopy__()" because apparently "The method didn't change
 standard __deepcopy__ in any way.".

 Well, in 1.7.0:


 {{{
 >>> from django.db.models import F
 >>> from copy import deepcopy
 >>> f = F ( "something__some_field" )
 >>> f.name
 'something__some_field'
 >>> g = deepcopy ( f )
 >>> g.name
 AttributeError: 'F' object has no attribute 'name'
 }}}

 Paste back in the same __deepcopy__ method removed in
 3a66035107a640c4905f0a5f247a45f32dbe16d7, and:

 {{{
 >>> from django.db.models import F
 >>> from copy import deepcopy
 >>> f = F ( "something__some_field" )
 >>> f.name
 'something__some_field'
 >>> g = deepcopy ( f )
 >>> g.name
 'something__some_field'
 }}}

 Tadaa!

 Can we have it back please?

--
Ticket URL: <https://code.djangoproject.com/ticket/23492>
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/046.1e93c54887c16d1e88d67ee49124fb58%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to