Skip to content
Snippets Groups Projects
Commit daea0469 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Fix multiple-inheritance object creation issue.

parent a98bf65c
No related branches found
No related tags found
No related merge requests found
...@@ -144,6 +144,14 @@ class Mesh(notifier.Notifier, meta.Meta): ...@@ -144,6 +144,14 @@ class Mesh(notifier.Notifier, meta.Meta):
""" """
def __new__(cls, *args, **kwargs):
"""Create a ``Mesh``. We must override ``__new__``, otherwise the
:class:`Meta` and :class:`Notifier` ``__new__`` methods will not be
called correctly.
"""
return super(Mesh, cls).__new__(cls, *args, **kwargs)
def __init__(self, def __init__(self,
indices, indices,
name='mesh', name='mesh',
......
...@@ -27,8 +27,13 @@ class Meta(object): ...@@ -27,8 +27,13 @@ class Meta(object):
setMeta setMeta
""" """
def __init__(self): def __new__(cls, *args, **kwargs):
self.__meta = collections.OrderedDict() """Initialises a ``Meta`` instance. """
new = super(Meta, cls).__new__(cls)
new.__meta = collections.OrderedDict()
return new
def metaKeys(self): def metaKeys(self):
......
...@@ -94,7 +94,7 @@ class Notifier(object): ...@@ -94,7 +94,7 @@ class Notifier(object):
instance. instance.
""" """
new = object.__new__(cls) new = super(Notifier, cls).__new__(cls)
# Listeners are stored in this # Listeners are stored in this
# #
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment