Opened 3 years ago

Closed 3 years ago

#33014 closed Cleanup/optimization (fixed)

ProjectState.__init__() can assume its real_apps argument is a set

Reported by: Chris Jerdonek Owned by: Chris Jerdonek
Component: Migrations Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

PR #14760 made all calls to ProjectState.__init__() pass real_apps as a set. In ProjectState.__init__() now, then, instead of checking that real_apps is a set and converting it to a set if not, it can just assert that it's a set when non-None. (Presumably the construction of new ProjectState objects is part of Django's internal API.) I had made this comment on the PR, but it wasn't important enough to hold up the PR because another PR was depending on it getting merged.

Change History (5)

comment:1 by Carlton Gibson, 3 years ago

Triage Stage: UnreviewedAccepted

Hey Chris.

I'm a bit Meh about the suggestion here but I'll accept so you can make the PR for review. (If the others like it...)

...part of Django's internal API

I'm forever amazed what parts of Django folks out there are using. Perhaps not this. :)

Thanks.

comment:2 by Chris Jerdonek, 3 years ago

Has patch: set

Thanks for entertaining this, Carlton. On the plus side, if people are using it, at least now they'll have a way of being alerted so they can take advantage of Mariusz's improvement and avoid unneeded set conversions...

PR: https://github.com/django/django/pull/14765

comment:3 by David Smith, 3 years ago

Owner: changed from nobody to Chris Jerdonek
Status: newassigned

comment:4 by Mariusz Felisiak, 3 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In 78005969:

Fixed #33014 -- Made ProjectState raise exception when real_apps argument is not a set.

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