django/django — pull request #592 by chmarr (2012-12-15 23:22:53+00:00)
Title: Fixed #19401 - "swapped" is pre-calculated attribute

swapped was turned from a property to a attribute set during Option.contribute_to_class()

While we could put the entire comparison fix into _swapped(), this function started looking very process intensive and given that other parts of the code use this frequently as a "have I been swapped" check, I believe calculating this _once_ and storing as an attribute is highly beneficial.

This differs from the previous pull request in that I do not have separate is_swapped, swapped_app_label and swapped_object_name attributes... instead leaving it as "swapped" in its original meaning.

Ie, the only change is that swapped is calculated once, with appropriate checking, rather than each time it is requested.