In 1.10.0, this fails with a TypeError:
import lazy_object_proxy
@lazy_object_proxy.Proxy
def Base():
class Base: pass
return Base
class Derived(Base): pass
The problem is that class takes type(Base) to be Derived's metaclass, and calls it with three arguments, but Proxy.__init__ expects only one.
Adding three metaclass methods to Proxy appears to fix the problem:
class FixedProxy(lazy_object_proxy.Proxy):
def __mro_entries__(self, bases):
return (self.__wrapped__,)
def __subclasscheck__(self, subclass):
return issubclass(subclass, self.__wrapped__)
def __instancecheck__(self, instance):
return isinstance(instance, self.__wrapped__)
In 1.10.0, this fails with a
TypeError:The problem is that
classtakestype(Base)to beDerived's metaclass, and calls it with three arguments, butProxy.__init__expects only one.Adding three metaclass methods to
Proxyappears to fix the problem: