TypeError: multiple bases have instance lay-out conflict
bakert opened this issue · 2 comments
Many thanks for Much – it's used literally everywhere in https://github.com/PennyDreadfulMTG/Penny-Dreadful-Tools
I'm using Munch in multiple inheritance and getting this error when using it alongside the latest version (only) of anytree's NodeMixin. This seems more like an anytree issue (NodeMixin is meant to be mixed in, hence the name) but I thought I'd ask here also in case it makes any sense to a Munch dev.
>>> from munch import Munch
>>> from anytree import NodeMixin
>>> class MyClass(Munch, NodeMixin):
... pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: multiple bases have instance lay-out conflict
Where anytree is https://github.com/c0fec0de/anytree
Googling around a bit this seems to be about conflicts in C implementations of classes on __foo__
attributes. Do you understand what is going on here and/or how I can fix? Thanks!
See also:
c0fec0de/anytree#77
PennyDreadfulMTG/Penny-Dreadful-Tools#6072
My guess is the usage of __slots__
on NodeMixin. I didn't dig too deep into it, but slots deeply affects on how objects behave in Python, and my guess is that it's in compatible with the fact that Munch derives from dict
...
Closing as it is a problem with anytree.