Ticket #10808: base.py.2.diff

File base.py.2.diff, 847 bytes (added by jianhuang, 6 years ago)

fixed the init bug with diamond inheritance, keeps track of pre-assigned fields with a set instead of a dict

  • base.py

     
    273273        # Now we're left with the unprocessed fields that *must* come from
    274274        # keywords, or default.
    275275
     276        set_fields = set([])
    276277        for field in fields_iter:
     278            if field.attname in set_fields:
     279                continue
    277280            is_related_object = False
    278281            # This slightly odd construct is so that we can access any
    279282            # data-descriptor object (DeferredAttribute) without triggering its
     
    311314                setattr(self, field.name, rel_obj)
    312315            else:
    313316                setattr(self, field.attname, val)
     317            set_fields.add(field.attname)
    314318
    315319        if kwargs:
    316320            for prop in kwargs.keys():
Back to Top