[IronPython] IPy1.1 expected Nullable[int] got NoneType

Ronnie Maor ronnie.maor at gmail.com
Fri Nov 16 21:48:46 CET 2007


with the following C# class:
public class A
{
    public A(int? i, string s1, string s2, string s3, string s4, string s5) { }
}

the following python code:
A(None, 'a', 'a', 'a', 'a', 'a')

fails with:
TypeError: expected Nullable[int], got NoneType

I don't know exactly when this happens. for example, reducing the
number of parameters to A (removing s5) makes the problem go away...

In IPy 2.0a5 this specific case works, so the problem might be fixed there.

the workaround I used for my code is to use some dummy non-None value
for the constructor, and then set the relevant property afterwards
with the right value, which may be None - no problems there. It's
ugly, but it works for my class.



More information about the Ironpython-users mailing list