Stop copying parent attributes into child class

This avoids breaking the normal MRO for attributes, which searches the class hierarchy for attribute definitions. If attributes are copied onto every class in the hierarchy, the C3 MRO algorithm finds the attribute in a child class even though that class didn't actually define it, which results in surprising attribute values when classes in the hierarchy set the same attribute to different values.
This commit is contained in:
Rob Percival 2022-02-08 15:45:15 +00:00 committed by Rob Percival
parent cad6dcb7f0
commit 9e8b0137d0
No known key found for this signature in database
GPG key ID: AA4DD8F79D700980

View file

@ -26,12 +26,6 @@ class ConfigurationBase(type):
if not importer.installed:
raise ImproperlyConfigured(install_failure)
settings_vars = uppercase_attributes(global_settings)
parents = [base for base in bases if isinstance(base,
ConfigurationBase)]
if parents:
for base in bases[::-1]:
settings_vars.update(uppercase_attributes(base))
deprecated_settings = {
# DEFAULT_HASHING_ALGORITHM is always deprecated, as it's a
# transitional setting