Commit daea0469 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Fix multiple-inheritance object creation issue.

parent a98bf65c
......@@ -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,
indices,
name='mesh',
......
......@@ -27,8 +27,13 @@ class Meta(object):
setMeta
"""
def __init__(self):
self.__meta = collections.OrderedDict()
def __new__(cls, *args, **kwargs):
"""Initialises a ``Meta`` instance. """
new = super(Meta, cls).__new__(cls)
new.__meta = collections.OrderedDict()
return new
def metaKeys(self):
......
......@@ -94,7 +94,7 @@ class Notifier(object):
instance.
"""
new = object.__new__(cls)
new = super(Notifier, cls).__new__(cls)
# Listeners are stored in this
#
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment