[IronPython] out parameters

Dino Viehland dinov at exchange.microsoft.com
Mon May 15 18:10:46 CEST 2006


Thanks for the bug report.  This is due to the enabling of our optimized code paths for all calls into C#.  I'll get a bug on this one filed and it should be fixed for beta 7 (tentatively scheduled for later this week).

Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Andrzej Krzywda
Sent: Monday, May 15, 2006 6:53 AM
To: users at lists.ironpython.com
Subject: [IronPython] out parameters

Hi all,

Having the following piece of C# code (note the ignore parameter):

    public class C
    {
        public static int M(out int i, out int j, out int k, bool ignore)
        {
            i = 20;
            j = 30;
            k = 40;
            return 10;
        }
    }


we call it from IronPython Beta 6:

i = C.M(True)

and we get :

        Unhandled Exception: generate:  type: System.DBNull
   at IronPython.Compiler.CodeGen.EmitRawConstant(Object value)
   at
IronPython.Compiler.ReflectOptimizer.MultiCallGenerator.EmitDefaultValue(I
nt32 param, MethodTracker method)
   at
IronPython.Compiler.ReflectOptimizer.MultiCallGenerator.EmitParameter(Meth
odTracker method, ParameterInfo pi, Int32 param)
   at
IronPython.Compiler.ReflectOptimizer.MultiCallGenerator.EmitParameters(Met
hodTracker method, ParameterInfo[] pis, Int32 paramOffset)
   at
IronPython.Compiler.ReflectOptimizer.MultiCallGenerator.EmitFinalCall(Meth
odTracker method)
   at IronPython.Compiler.ReflectOptimizer.MultiCallGenerator.Walk(Int32
param,
ParamTreeNode node)
   at IronPython.Compiler.ParamTree.WalkWorker(IParamWalker callback,
ParamTreeN
ode curNode, Int32 depth)
   at IronPython.Compiler.ParamTree.Walk(IParamWalker callback)
   at IronPython.Compiler.ReflectOptimizer.GenerateTargetMethod(TypeGen
tg, Stri
ng name, FunctionType funcType, MethodTracker[] methods, Int32 argCnt,
Boolean p
aramsMethod)
   at IronPython.Compiler.ReflectOptimizer.GenerateAllTargets(TypeGen
tg, String
 name, MethodTracker[] methods, FunctionType funcType)
   at IronPython.Compiler.ReflectOptimizer.MakeFunction(BuiltinFunction rm)
   at IronPython.Runtime.ReflectedMethodBase.OptimizeMethod()
   at IronPython.Runtime.ReflectedMethodBase.TryOptimizedCall(Object[]
args, Obj
ect& ret)
   at IronPython.Runtime.ReflectedMethodBase.TryCallWorker(Object[]
args, Object
& ret)
   at IronPython.Runtime.ReflectedMethodBase.Call(Object[] args)
   at IronPython.Runtime.ReflectedMethodBase.Call(ICallerContext
context, Object
[] args)
   at IronPython.Runtime.ReflectedMethodBase.Call(ICallerContext
context, Object
 arg0)
   at IronPython.Runtime.Ops.CallWithContext(ICallerContext context,
Object func
, Object arg0)
   at __main__.testOut$f0(FunctionEnvironment16Dictionary $env, Object
self) in
C:\IronPythonTest.py:line 21
   at IronPython.Runtime.Function1.Call(Object arg0)
   at IronPython.Runtime.Ops.Call(Object func, Object arg0)
   at IronPython.Runtime.Method.Call()
   at IronPython.Runtime.Ops.CallWithContext(ICallerContext context,
Object func
)

However, if we change the order of the parameters so that "bool ignore"
is the first one, it works !%$£"#@&&*

We think this worked in beta 4, as we only caught this when moving our
code to the beta 6 IronPython.

See the following email for previous discussions on the subject :


http://lists.ironpython.com/pipermail/users-ironpython.com/2005-May/000644.html

Andrzej Krzywda
Michael Foord
http://www.resolversystems.com
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list