[IronPython] list -> Array conversion in Beta 8
Bruce Christensen
t-bruch at microsoft.com
Fri Jun 30 12:11:46 PDT 2006
Implicit conversion from list to array was removed in beta 8. For more
details, see:
http://lists.ironpython.com/pipermail/users-ironpython.com/2006-June/002
583.html
For an easy workaround, you can use the technique mentioned here:
http://lists.ironpython.com/pipermail/users-ironpython.com/2006-June/002
621.html
--Bruce
-----Original Message-----
From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Milman, Seth
Sent: Friday, June 30, 2006 12:03 PM
To: Discussion of IronPython
Subject: [IronPython] list -> Array conversion in Beta 8
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:
More information about the users
mailing list