[Django] #28043: Cloning a ModelState fails to deepcopy all options

4 views
Skip to first unread message

Django

unread,
Apr 6, 2017, 11:08:21 AM4/6/17
to django-...@googlegroups.com
#28043: Cloning a ModelState fails to deepcopy all options
-------------------------------------+-------------------------------------
Reporter: Ian Foote | Owner: nobody
Type: Bug | Status: new
Component: | Version: master
Migrations |
Severity: Release | Keywords: ModelState clone
blocker | indexes
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
In
[https://github.com/django/django/blob/351835f26234cade43f0bed45441fc144c33a785/django/db/migrations/state.py#L548
ModelState.clone], we copy the {{{self.options}}} dictionary, but this
fails to copy any mutable values, specifically {{{indexes}}}. Since
{{{AddIndex.state_forwards}}} mutates {{{indexes}}}, this leads to an
invalid state.

--
Ticket URL: <https://code.djangoproject.com/ticket/28043>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 6, 2017, 11:09:17 AM4/6/17
to django-...@googlegroups.com
#28043: Cloning a ModelState fails to deepcopy all options
-------------------------------------+-------------------------------------
Reporter: Ian Foote | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: ModelState clone | Triage Stage: Accepted
indexes |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* version: master => 1.11
* stage: Unreviewed => Accepted


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

Django

unread,
Apr 6, 2017, 11:44:59 AM4/6/17
to django-...@googlegroups.com
#28043: Cloning a ModelState fails to deepcopy all options
-------------------------------------+-------------------------------------
Reporter: Ian Foote | Owner: Ian Foote
Type: Bug | Status: assigned

Component: Migrations | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: ModelState clone | Triage Stage: Accepted
indexes |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ian Foote):

* owner: nobody => Ian Foote
* status: new => assigned


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

Django

unread,
Apr 6, 2017, 12:07:11 PM4/6/17
to django-...@googlegroups.com
#28043: Cloning a ModelState fails to deepcopy all options
-------------------------------------+-------------------------------------
Reporter: Ian Foote | Owner: Ian Foote
Type: Bug | Status: assigned
Component: Migrations | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: ModelState clone | Triage Stage: Accepted
indexes |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ian Foote):

* has_patch: 0 => 1


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

Django

unread,
May 1, 2017, 10:08:52 AM5/1/17
to django-...@googlegroups.com
#28043: Cloning a ModelState fails to deepcopy all options
-------------------------------------+-------------------------------------
Reporter: Ian Foote | Owner: Ian Foote
Type: Bug | Status: closed
Component: Migrations | Version: 1.11
Severity: Release blocker | Resolution: fixed

Keywords: ModelState clone | Triage Stage: Accepted
indexes |
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: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"63afe3a2bfaf97fecff6641137a85296029d5b73" 63afe3a2]:
{{{
#!CommitTicketReference repository=""
revision="63afe3a2bfaf97fecff6641137a85296029d5b73"
Fixed #28043 -- Prevented AddIndex and RemoveIndex from mutating model
state.
}}}

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

Django

unread,
May 1, 2017, 10:11:14 AM5/1/17
to django-...@googlegroups.com
#28043: Cloning a ModelState fails to deepcopy all options
-------------------------------------+-------------------------------------
Reporter: Ian Foote | Owner: Ian Foote
Type: Bug | Status: closed
Component: Migrations | Version: 1.11
Severity: Release blocker | Resolution: fixed
Keywords: ModelState clone | Triage Stage: Accepted
indexes |
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:"211d2bf3f21fee22c868cd39452a133ad1e16c4d" 211d2bf3]:
{{{
#!CommitTicketReference repository=""
revision="211d2bf3f21fee22c868cd39452a133ad1e16c4d"
[1.11.x] Fixed #28043 -- Prevented AddIndex and RemoveIndex from mutating
model state.

Backport of 63afe3a2bfaf97fecff6641137a85296029d5b73 from master
}}}

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

Reply all
Reply to author
Forward
0 new messages