biqqles / dataclassy

A fast and flexible reimplementation of data classes
https://pypi.org/project/dataclassy
Mozilla Public License 2.0
81 stars 9 forks source link

Metaclass is too inclusive with new class dict #35

Closed biqqles closed 3 years ago

biqqles commented 3 years ago

DataClassMeta currently collects the contents of the inherited classes' dicts and passes this as the dictionary of the new class to type.__new__. This can prevent type.__new__ from doing method inheritance "correctly" and is the reason this test fails.

biqqles commented 3 years ago

The referenced commits fix this issue, at least to the point that all tests work. This means that multiple-inheritance use of super() and overriding normal and magic methods all work as expected. As a bonus, the way attributes are shuffled in DataClassMeta.__new__ is a lot clearer now.