Open
Description
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__)
Metadata
Metadata
Assignees
Labels
No labels