[Django] #27512: Dead code path in Model.__init__

12 views
Skip to first unread message

Django

unread,
Nov 20, 2016, 8:27:29 AM11/20/16
to django-...@googlegroups.com
#27512: Dead code path in Model.__init__
-----------------------------------------+------------------------
Reporter: Adam Chainz | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.10
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 |
-----------------------------------------+------------------------
These lines in `Model.__init__` look suspicious to me:

{{{
# Maintain compatibility with existing calls.
if isinstance(field.remote_field, ManyToOneRel):
kwargs.pop(field.attname, None)
}}}

There's no test coverage for them, and they have remained untouched since
they were added in #3438 10 years ago, as an optimization rewrite of
`Model.__init__`. Afaict they aren't needed.

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

Django

unread,
Nov 20, 2016, 8:28:37 AM11/20/16
to django-...@googlegroups.com
#27512: Dead code path in Model.__init__
-------------------------------------+-------------------------------------

Reporter: Adam Chainz | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

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

* type: Uncategorized => Cleanup/optimization
* has_patch: 0 => 1
* component: Uncategorized => Database layer (models, ORM)


Comment:

https://github.com/django/django/pull/7580

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

Django

unread,
Nov 20, 2016, 8:38:55 AM11/20/16
to django-...@googlegroups.com
#27512: Dead code path in Model.__init__
-------------------------------------+-------------------------------------
Reporter: Adam Chainz | Owner: Adam
Type: | Chainz
Cleanup/optimization | Status: assigned

Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

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

* owner: nobody => Adam Chainz
* status: new => assigned


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

Django

unread,
Nov 20, 2016, 8:56:29 AM11/20/16
to django-...@googlegroups.com
#27512: Dead code path in Model.__init__
-------------------------------------+-------------------------------------
Reporter: Adam Chainz | Owner: Adam
Type: | Chainz
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

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

* cc: me@… (added)


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

Django

unread,
Nov 20, 2016, 7:39:42 PM11/20/16
to django-...@googlegroups.com
#27512: Dead code path in Model.__init__
-------------------------------------+-------------------------------------
Reporter: Adam Chainz | Owner: Adam
Type: | Chainz
Cleanup/optimization | Status: closed

Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage:
| Unreviewed
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:"74742aa956d9cef0493b57f50f1cb7dc0f987fc6" 74742aa]:
{{{
#!CommitTicketReference repository=""
revision="74742aa956d9cef0493b57f50f1cb7dc0f987fc6"
Fixed #27512 -- Removed unused code in Model.__init__().
}}}

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

Reply all
Reply to author
Forward
0 new messages