Opened 7 years ago

Closed 7 years ago

#27512 closed Cleanup/optimization (fixed)

Dead code path in Model.__init__

Reported by: Adam Johnson Owned by: Adam Johnson
Component: Database layer (models, ORM) Version: 1.10
Severity: Normal Keywords:
Cc: me@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (4)

comment:1 by Adam Johnson, 7 years ago

Component: UncategorizedDatabase layer (models, ORM)
Has patch: set
Type: UncategorizedCleanup/optimization

comment:2 by Adam Johnson, 7 years ago

Owner: changed from nobody to Adam Johnson
Status: newassigned

comment:3 by Adam Johnson, 7 years ago

Cc: me@… added

comment:4 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In 74742aa:

Fixed #27512 -- Removed unused code in Model.init().

Note: See TracTickets for help on using tickets.
Back to Top