[Django] #23492: F objects are no longer deepcopy-able

4 views
Skip to first unread message

Django

unread,
Sep 16, 2014, 5:11:58 AM9/16/14
to django-...@googlegroups.com
#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.

Django

unread,
Sep 16, 2014, 6:01:42 AM9/16/14
to django-...@googlegroups.com
#23492: F objects are no longer deepcopy-able
-------------------------------------+-------------------------------------
Reporter: ris | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.7
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: F object expression | Needs documentation: 0
deepcopy | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by bmispelon):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

Hi,

I can indeed reproduce your issue and bisecting it points to
3a66035107a640c4905f0a5f247a45f32dbe16d7 as you suspected.

We should probably add the method back but also add some tests to make
sure we don't break that again.

Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/23492#comment:1>

Django

unread,
Sep 16, 2014, 6:21:26 AM9/16/14
to django-...@googlegroups.com
#23492: F objects are no longer deepcopy-able
-------------------------------------+-------------------------------------
Reporter: ris | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 1.7
(models, ORM) | Resolution: fixed

Severity: Normal | Triage Stage: Accepted
Keywords: F object expression | Needs documentation: 0
deepcopy | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by Baptiste Mispelon <bmispelon@…>):

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


Comment:

In [changeset:"d63ac5b595694c44ed8a64d782a177d2f92125d9"]:
{{{
#!CommitTicketReference repository=""
revision="d63ac5b595694c44ed8a64d782a177d2f92125d9"
Fixed #23492 -- Restored F.__deepcopy__.

This reverts commit 3a66035107a640c4905f0a5f247a45f32dbe16d7.
A regression test was also added.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23492#comment:2>

Django

unread,
Sep 16, 2014, 6:24:49 AM9/16/14
to django-...@googlegroups.com
#23492: F objects are no longer deepcopy-able
-------------------------------------+-------------------------------------
Reporter: ris | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 1.7
(models, ORM) | Resolution: fixed
Severity: Normal | Triage Stage: Accepted
Keywords: F object expression | Needs documentation: 0
deepcopy | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------

Comment (by Baptiste Mispelon <bmispelon@…>):

In [changeset:"04e7c7d51f832407c49c3abb3413fbfbdb410f6f"]:
{{{
#!CommitTicketReference repository=""
revision="04e7c7d51f832407c49c3abb3413fbfbdb410f6f"
[1.7.x] Fixed #23492 -- Restored F.__deepcopy__.

This reverts commit 3a66035107a640c4905f0a5f247a45f32dbe16d7.
A regression test was also added.

Backport of d63ac5b595694c44ed8a64d782a177d2f92125d9 from master.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23492#comment:3>

Django

unread,
Sep 16, 2014, 8:32:55 AM9/16/14
to django-...@googlegroups.com
#23492: F objects are no longer deepcopy-able
-------------------------------------+-------------------------------------
Reporter: ris | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 1.7
(models, ORM) | Resolution: fixed
Severity: Normal | Triage Stage: Accepted
Keywords: F object expression | Needs documentation: 0
deepcopy | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------

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

In [changeset:"92a8213fdbb6f7612847f3d803a9f91d0f9d6392"]:
{{{
#!CommitTicketReference repository=""
revision="92a8213fdbb6f7612847f3d803a9f91d0f9d6392"
Added 1.7.1 release notes for refs #23492.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23492#comment:4>

Django

unread,
Sep 16, 2014, 8:33:14 AM9/16/14
to django-...@googlegroups.com
#23492: F objects are no longer deepcopy-able
-------------------------------------+-------------------------------------
Reporter: ris | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 1.7
(models, ORM) | Resolution: fixed
Severity: Normal | Triage Stage: Accepted
Keywords: F object expression | Needs documentation: 0
deepcopy | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------

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

In [changeset:"3f6430d084097082ea02a8e49ce3e28c7b75582c"]:
{{{
#!CommitTicketReference repository=""
revision="3f6430d084097082ea02a8e49ce3e28c7b75582c"
[1.7.x] Added 1.7.1 release notes for refs #23492.

Backport of 92a8213fdb from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23492#comment:5>

Reply all
Reply to author
Forward
0 new messages