[IronPython] Comparing clr objects in lists

2006-10-03 Thread Andrzej Krzywda
Hello all,

We found an issue with comparing clr objects in lists.

IronPython 1.0.60816 on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
  import clr
  clr.AddReference('System.Drawing')
  from System.Drawing import Color
 
  Color.Red == Color.Red
True
  (Color.Red) == (Color.Red)
True
  [Color.Red] == [Color.Red]
False
  [(Color.Red)] == [(Color.Red)]
False

The same kind of comparison will work with IronPython objects.

Andrzej Krzywda
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] CallTarget0

2006-06-21 Thread Andrzej Krzywda
Thanks Dino.

Here is the actual stack trace:

  form.Invoke(DoSomething)
Object reference not set to an instance of an object.
   at IronPython.Runtime.Operations.Ops.GetDelegate(Object o, Type 
delegateType)

   at IronPython.Runtime.Converter.TryConvertToDelegate(Object value, 
Type to, C
onversion conversion)
   at IronPython.Runtime.Converter.ConvertToDelegate(Object value, Type to)
   at IronPython.Runtime.NewConverter.ConvertToDelegate(Object o, Type t)
   at Invoke##18(ICallerContext , Object , Object )
   at 
IronPython.Runtime.Calls.CallTargetWithContext2.Invoke(ICallerContext cont
ext, Object arg0, Object arg1)
   at 
IronPython.Runtime.Calls.FastCallableWithContextAny.CallInstance(ICallerCo
ntext context, Object arg0, Object arg1)
   at IronPython.Runtime.Calls.BoundBuiltinFunction.Call(ICallerContext 
context,
 Object arg0)
   at IronPython.Runtime.Operations.Ops.CallWithContext(ICallerContext 
context,
Object func, Object arg0)
   at stdin##17(ModuleScope )
   at IronPython.Runtime.CompiledCodeDelegate.Invoke(ModuleScope 
moduleScope)
   at IronPython.Runtime.CompiledCode.Run(ModuleScope moduleScope)
   at IronPython.Hosting.PythonEngine.ExecuteToConsole(String text, 
ModuleScope
defaultScope)
   at IronPythonConsole.PythonCommandLine.DoOneInteractive(ModuleScope 
topFrame)

   at 
IronPythonConsole.PythonCommandLine.RunInteractiveLoopb__6(Boolean cont
inueInteractionArgument)
   at 
IronPythonConsole.PythonCommandLine.TryInteractiveAction(InteractiveAction
 interactiveAction, Boolean continueInteraction)
SystemError: Object reference not set to an instance of an object.
 

Dino Viehland wrote:
 CallTarget0 has actually just moved to IronPython.Runtime.Calls (we used to 
 have over 200 classes in IronPython.Runtime which was just too many).

 The exception you're getting is still potentially interesting - could you 
 send us the stack trace when running w/ -X:ExceptionDetail ?

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrzej Krzywda
 Sent: Wednesday, June 21, 2006 9:52 AM
 To: users@lists.ironpython.com
 Subject: [IronPython] CallTarget0

 Hi,

 We are in the process of upgrading an application from IronPython Beta 5 to 
 Beta 8.  Previously it would execute certain functions on the thread 
 belonging to our GUI controls:

 def DoSomething()
 pass

 form.Invoke(CallTarget0(DoSomething))

 In beta 8, the CallTarget0 class has been removed - what should we replace it 
 with?  We tried simply passing the function to the Invoke() method, but this 
 failed with SystemError: Object reference not set to an instance of an 
 object.


 Regards,

 Andrzej Krzywda
 ___
 users mailing list
 users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 ___
 users mailing list
 users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

   

___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] out parameters

2006-05-15 Thread Andrzej Krzywda
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@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Compiler flags

2006-05-08 Thread Andrzej Krzywda
Hi all,

It seems that IronPython doesn't deal correctly with compiler flags 
(8192 is the compiler flag for __future__.division).

IronPython Beta 6

  exec(compile(print 2/3, string, exec, 8192), {})
0


CPython
  exec(compile(print 2/3, string, exec, 8192), {})
0.6667

Andrzej Krzywda
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Ignoring dont_inherit compiler flag

2006-05-08 Thread Andrzej Krzywda
Hi,

IronPython ignores the dont_inherit compiler flag:

IronPython Beta 6:

  from __future__ import division
  exec(compile(print 2/3, string, exec, 0, 1), {})
0.6667


CPython:

  from __future__ import division
  exec(compile(print 2/3, string, exec, 0, 1), {})
0

Andrzej Krzywda


___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] .NET Attributes

2006-03-27 Thread Andrzej Krzywda
Hi,

When there will be support for .NET Attributes in IronPython?
Is there any way currently to mark my class as Serializable?

-- 
Andrzej
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com