patch to allow for null array references in method calls

I've ran into a problem with Converter.ToManaged when trying to call ILGenerator.EmitCall. EmitCall demands its last parameter (of type System.Type[]) to be null for non-varargs methods but Converter.ToManager wouldn't convert None to a null reference. My solution was simply to move the explicit check for Runtime.PyNone to the line 186, before the IsArray check: <snip> if (value == Runtime.PyNone && !obType.IsValueType) { result = null; return true; } if (obType.IsArray) { return ToArray(value, obType, out result, setError); } if (obType.IsEnum) { return ToEnum(value, obType, out result, setError); } </snip> Is this correct? Best wishes, Rodrigo

Sorry to be so late replying - I'm playing catchup and losing w/my mail :( Thanks for the fix - I'll get this checked in w/a unit test as soon as I can. Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com
I've ran into a problem with Converter.ToManaged when trying to call ILGenerator.EmitCall. EmitCall demands its last parameter (of type System.Type[]) to be null for non-varargs methods but Converter.ToManager wouldn't convert None to a null reference.
My solution was simply to move the explicit check for Runtime.PyNone to the line 186, before the IsArray check:
<snip>
if (value == Runtime.PyNone && !obType.IsValueType) { result = null; return true; }
if (obType.IsArray) { return ToArray(value, obType, out result, setError); }
if (obType.IsEnum) { return ToEnum(value, obType, out result, setError); } </snip>
Is this correct?
Best wishes, Rodrigo
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
participants (2)
-
Brian Lloyd
-
Rodrigo B. de Oliveira