Thanks for reporting this Sylvain.  I believe this is the same or very similar 
to bug #7594 
(http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=7594).

The good news is that this is fixed in our internal v2.0 branch.  The bad news 
is the fix was close to re-writing the type system (also fixing type(type) is 
type).  That makes it fairly unlikely that we'll be able to back port this to 
v1.x without seriously destabilizing it.  But it will be fixed in the future.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sylvain 
Hellegouarch
Sent: Wednesday, March 07, 2007 6:15 AM
To: Discussion of IronPython
Subject: [IronPython] Metaclass bug?

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

_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to