question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NodeMixin - TypeError: multiple bases have instance lay-out conflict

See original GitHub issue

Works: 2.4.3 Breaks: 2.6.0

>>> 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 munch is https://github.com/Infinidat/munch

Googling around a bit this seems to be about conflicts in C implementations of classes on __foo__ attributes. So I did this:

>>> [k for k in dir(Munch) if k in dir(NodeMixin)]
['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']

but it didn’t make me feel much smarter.

Does this mean anything to you anytree peeps? I came here because obviously NodeMixin is meant to be mixed in so this feels like a bug rather than just a stupid thing I should not be attempting to do. Especially as it used to work until this version.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
c0fec0decommented, Sep 24, 2019

slots will be removed

1reaction
c0fec0decommented, Feb 19, 2019

Yes. __slots__ has been added. Please try:

>>> from munch import Munch
>>> from anytree import NodeMixin
>>> class MyNodeMixin(NodeMixin):
...     pass
>>> class MyClass(Munch, MyNodeMixin):
...     pass

As __slots__ is not inherited, it might work

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: multiple bases have instance lay-out conflict
Instance lay-out conflict is a fancy way of saying that you're trying to inherit from multiple--in this case built-in--types that cannot ...
Read more >
TypeError: multiple bases have instance lay-out conflict
Hi, I'm trying to figure out all pairs of builtin types that have instance lay-out conflicts. Is that easy to determine from the...
Read more >
TypeError: multiple bases have instance lay-out conflict
The builtin type dict and a new-style class with slots both define custom object layouts at the C level. The C layout of...
Read more >
Multiple Inheritance __slots__ problem - Python - Bytes
TypeError : multiple bases have instance lay-out conflict. I need to define slots in these classes and also need to inherit them in....
Read more >
webcomponents/webcomponentsjs
@webcomponents/webcomponentsjs/webcomponents-bundle.js.map ... if elements do not have `innerHTML` on instances, then\n // templates can be patched by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found