@@ -519,7 +519,7 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo
519519 return true ;
520520
521521 case TypeCode . Byte :
522- #if PYTHON3
522+ #if ! PYTHON2
523523 if ( Runtime . PyObject_TypeCheck ( value , Runtime . PyBytesType ) )
524524 {
525525 if ( Runtime . PyBytes_Size ( value ) == 1 )
@@ -530,7 +530,7 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo
530530 }
531531 goto type_error ;
532532 }
533- #elif PYTHON2
533+ #else
534534 if ( Runtime . PyObject_TypeCheck ( value , Runtime . PyStringType ) )
535535 {
536536 if ( Runtime . PyString_Size ( value ) == 1 )
@@ -564,7 +564,7 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo
564564 return true ;
565565
566566 case TypeCode . SByte :
567- #if PYTHON3
567+ #if ! PYTHON2
568568 if ( Runtime . PyObject_TypeCheck ( value , Runtime . PyBytesType ) )
569569 {
570570 if ( Runtime . PyBytes_Size ( value ) == 1 )
@@ -575,7 +575,7 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo
575575 }
576576 goto type_error ;
577577 }
578- #elif PYTHON2
578+ #else
579579 if ( Runtime . PyObject_TypeCheck ( value , Runtime . PyStringType ) )
580580 {
581581 if ( Runtime . PyString_Size ( value ) == 1 )
@@ -609,7 +609,7 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo
609609 return true ;
610610
611611 case TypeCode . Char :
612- #if PYTHON3
612+ #if ! PYTHON2
613613 if ( Runtime . PyObject_TypeCheck ( value , Runtime . PyBytesType ) )
614614 {
615615 if ( Runtime . PyBytes_Size ( value ) == 1 )
@@ -620,7 +620,7 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo
620620 }
621621 goto type_error ;
622622 }
623- #elif PYTHON2
623+ #else
624624 if ( Runtime . PyObject_TypeCheck ( value , Runtime . PyStringType ) )
625625 {
626626 if ( Runtime . PyString_Size ( value ) == 1 )
@@ -728,20 +728,20 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo
728728 }
729729 goto type_error ;
730730 }
731-
731+
732732 uint ui ;
733- try
733+ try
734734 {
735735 ui = Convert . ToUInt32 ( Runtime . PyLong_AsUnsignedLong ( op ) ) ;
736736 } catch ( OverflowException )
737737 {
738738 // Probably wasn't an overflow in python but was in C# (e.g. if cpython
739- // longs are 64 bit then 0xFFFFFFFF + 1 will not overflow in
739+ // longs are 64 bit then 0xFFFFFFFF + 1 will not overflow in
740740 // PyLong_AsUnsignedLong)
741741 Runtime . XDecref ( op ) ;
742742 goto overflow ;
743743 }
744-
744+
745745
746746 if ( Exceptions . ErrorOccurred ( ) )
747747 {
@@ -875,7 +875,7 @@ private static bool ToArray(IntPtr value, Type obType, out object result, bool s
875875
876876 var listType = typeof ( List < > ) ;
877877 var constructedListType = listType . MakeGenericType ( elementType ) ;
878- IList list = IsSeqObj ? ( IList ) Activator . CreateInstance ( constructedListType , new Object [ ] { ( int ) len } ) :
878+ IList list = IsSeqObj ? ( IList ) Activator . CreateInstance ( constructedListType , new Object [ ] { ( int ) len } ) :
879879 ( IList ) Activator . CreateInstance ( constructedListType ) ;
880880 IntPtr item ;
881881
@@ -896,7 +896,7 @@ private static bool ToArray(IntPtr value, Type obType, out object result, bool s
896896
897897 items = Array . CreateInstance ( elementType , list . Count ) ;
898898 list . CopyTo ( items , 0 ) ;
899-
899+
900900 result = items ;
901901 return true ;
902902 }
0 commit comments