[IronPython] Metaclass bug?
Sylvain Hellegouarch
sh at defuze.org
Wed Mar 7 06:14:39 PST 2007
The following code:
class C(object):
pass
class Meta(type):
pass
class A(object):
__metaclass__ = Meta
def __init__(self, e, s):
print "__init__ A"
def __call__(self, e, s):
print "__call__ A"
class B(object):
def mount(self, c):
a = A(c, "")
if __name__ == '__main__':
b = B()
b.mount(C())
=============================================
Python 2.5
$ python test.py
__init__ A
=============================================
IronPython 1.1b1 (1.1) on .NET 2.0.50727.42
$ mono bin/ipy.exe test.py
Traceback (most recent call last):
File test, line unknown, in Initialize
File test, line unknown, in mount
TypeError: unbound method __call__() must be called with A instance as
first argument (got C instance instead)
It appears that because of the meta-class IP gets confused as to what to
call since the __init__ and __call__ gave the same signature.
- Sylvain
More information about the users
mailing list