[IronPython] list -> Array conversion in Beta 8
J. Merrill
jvm_cop at spamcop.net
Sat Jul 1 00:13:15 CEST 2006
As was pointed out, this was intentionally changed. In your sample, you should be able to do
print myClass.SumArray( tuple(L) )
That is, just convert the list to a tuple.
At 03:03 PM 6/30/2006, Milman, Seth wrote
>Hi,
>I just upgraded from Beta 7 to Beta 8 and I'm having a problem passing
>runtime lists to assembly functions that expect an array. In beta 7,
>the list went through function
>IronPython.Runtime.Converter.TryConvertToArray. In beta 8, it is passed
>to IronPython.Runtime.NewConverter.ConvertToArray.
>
>Beta 7 seemed to work, Beta 8 doesn't. Is this new behavior by design?
>If so, how should I work around it?
>
>Here is a repro:
>
>
>// C# Code
>Namespace mySpace {
> public class myClass {
> public static double SumArray( System.Double[] a ) {
> double sum = 0.0;
> foreach( double d in a ) {
> sum += d;
> }
> return sum;
> }
> }
>}
>
>
># Python code
>...
>L = [1.0, 2.0, 3.0]
>print myClass.SumArray( L )
>
>
>In beta 7 it works.
>In beta 8, I get this exception trace:
>
>expected array_float, found list [snip]
>
>Any suggestions?
>
>Thanks,
>
>Seth Milman
J. Merrill / Analytical Software Corp
More information about the Ironpython-users
mailing list