[Python.NET] patch to allow for null array references in methodcalls

Brian Lloyd brian at zope.com
Tue Jan 6 09:18:50 EST 2004


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 at 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 at python.org
> http://mail.python.org/mailman/listinfo/pythondotnet
> 



More information about the PythonDotNet mailing list