@@ -433,9 +433,7 @@ internal Binding Bind(IntPtr inst, IntPtr args, IntPtr kw, MethodBase info, Meth
433
433
pi = pi . Take ( 1 ) . ToArray ( ) ;
434
434
}
435
435
int outs ;
436
- var margs = TryConvertArguments ( pi , paramsArray , args , pynargs , kwargDict , defaultArgList ,
437
- needsResolution : _methods . Length > 1 , // If there's more than one possible match.
438
- outs : out outs ) ;
436
+ var margs = TryConvertArguments ( pi , paramsArray , args , pynargs , kwargDict , defaultArgList , outs : out outs ) ;
439
437
if ( margs == null )
440
438
{
441
439
var mismatchCause = PythonException . FetchCurrent ( ) ;
@@ -612,7 +610,6 @@ static object[] TryConvertArguments(ParameterInfo[] pi, bool paramsArray,
612
610
IntPtr args , int pyArgCount ,
613
611
Dictionary < string , IntPtr > kwargDict ,
614
612
ArrayList defaultArgList ,
615
- bool needsResolution ,
616
613
out int outs )
617
614
{
618
615
outs = 0 ;
@@ -653,7 +650,7 @@ static object[] TryConvertArguments(ParameterInfo[] pi, bool paramsArray,
653
650
}
654
651
655
652
bool isOut ;
656
- if ( ! TryConvertArgument ( op , parameter . ParameterType , needsResolution , out margs [ paramIndex ] , out isOut ) )
653
+ if ( ! TryConvertArgument ( op , parameter . ParameterType , out margs [ paramIndex ] , out isOut ) )
657
654
{
658
655
return null ;
659
656
}
@@ -681,16 +678,15 @@ static object[] TryConvertArguments(ParameterInfo[] pi, bool paramsArray,
681
678
/// </summary>
682
679
/// <param name="op">Pointer to the Python argument object.</param>
683
680
/// <param name="parameterType">That parameter's managed type.</param>
684
- /// <param name="needsResolution">If true, there are multiple overloading methods that need resolution.</param>
685
681
/// <param name="arg">Converted argument.</param>
686
682
/// <param name="isOut">Whether the CLR type is passed by reference.</param>
687
683
/// <returns>true on success</returns>
688
- static bool TryConvertArgument ( IntPtr op , Type parameterType , bool needsResolution ,
684
+ static bool TryConvertArgument ( IntPtr op , Type parameterType ,
689
685
out object arg , out bool isOut )
690
686
{
691
687
arg = null ;
692
688
isOut = false ;
693
- var clrtype = TryComputeClrArgumentType ( parameterType , op , needsResolution : needsResolution ) ;
689
+ var clrtype = TryComputeClrArgumentType ( parameterType , op ) ;
694
690
if ( clrtype == null )
695
691
{
696
692
return false ;
@@ -710,25 +706,14 @@ static bool TryConvertArgument(IntPtr op, Type parameterType, bool needsResoluti
710
706
/// </summary>
711
707
/// <param name="parameterType">The parameter's managed type.</param>
712
708
/// <param name="argument">Pointer to the Python argument object.</param>
713
- /// <param name="needsResolution">If true, there are multiple overloading methods that need resolution.</param>
714
709
/// <returns>null if conversion is not possible</returns>
715
- static Type TryComputeClrArgumentType ( Type parameterType , IntPtr argument , bool needsResolution )
710
+ static Type TryComputeClrArgumentType ( Type parameterType , IntPtr argument )
716
711
{
717
712
// this logic below handles cases when multiple overloading methods
718
713
// are ambiguous, hence comparison between Python and CLR types
719
714
// is necessary
720
715
Type clrtype = null ;
721
716
IntPtr pyoptype ;
722
- if ( needsResolution )
723
- {
724
- // HACK: each overload should be weighted in some way instead
725
- pyoptype = Runtime . PyObject_Type ( argument ) ;
726
- if ( pyoptype != IntPtr . Zero )
727
- {
728
- clrtype = Converter . GetTypeByAlias ( pyoptype ) ;
729
- }
730
- Runtime . XDecref ( pyoptype ) ;
731
- }
732
717
733
718
if ( clrtype != null )
734
719
{
0 commit comments