[IronPython] Misleading error messages

Martin Maly Martin.Maly at microsoft.com
Mon Sep 26 18:24:24 CEST 2005

The incorrect number of arguments misleading error is a known problem
that I haven't had time to fix yet.


-----Original Message-----
From: users-ironpython.com-bounces at lists.ironpython.com
[mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of
Ray Djajadinata
Sent: Sunday, September 25, 2005 3:39 AM
To: users-ironpython.com at lists.ironpython.com
Subject: [IronPython] Misleading error messages


I'm playing around with list in IronPython 0.9.2, when I found that
error messages regarding the (wrong) number of arguments passed into a
function always tells you that the function takes 0 argument:

>>> horsemen = ["Pestilence", "War", "Famine",
>>> horsemen.count()
Traceback (most recent call last):
   at <shell>
TypeError: count() takes exactly 0 argument (1 given)
>>> horsemen.insert(1)
Traceback (most recent call last):
   at <shell>
TypeError: insert() takes exactly 0 argument (2 given) </snippet>

This happens to built-in function as well:

>>> abs()
Traceback (most recent call last):
   at <shell>
TypeError: abs() takes exactly 0 argument (0 given) </snippet>

This seems to be a problem with .NET Framework 2.0 instead of IP,
though. In TypeGen.cs, line 114:

MethodBuilder mb = myType.DefineMethod(name, attrs, retType,

return new CodeGen(this, mb, mb.GetILGenerator()); </snippet>

In that snippet above, although the paramTypes is a Type[] of length 1
(created using makeArray() in Constant.cs), somehow the MethodBuilder
instance that
DefineMethod() returns has 0 argument. In the case of
abs() above, the property Signature prints:

{Name: abs
Attributes: 22
Method Signature: Length: 4
Arguments: 0
0  0  28  28  0  


I've tried it with .NET Framework 1.1 (just the part
about creating the MethodBuilder) and the result is:

Length: 4
Arguments: 1
0  1  28  28  0  


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
users-ironpython.com mailing list
users-ironpython.com at lists.ironpython.com

More information about the Ironpython-users mailing list