@@ -565,18 +565,11 @@ internal static unsafe void XDecref(IntPtr op)
565
565
internal static unsafe long Refcount( IntPtr op )
566
566
{
567
567
var p = ( void * ) op ;
568
- if ( ( void * ) 0 ! = p )
568
+ if ( ( void * ) 0 = = p )
569
569
{
570
- if ( Is32Bit )
571
- {
572
- return ( * ( int * ) p ) ;
573
- }
574
- else
575
- {
576
- return ( * ( long * ) p ) ;
577
- }
570
+ return 0 ;
578
571
}
579
- return 0 ;
572
+ return Is32Bit ? ( * ( int * ) p ) : ( * ( long * ) p ) ;
580
573
}
581
574
582
575
#if PYTHON_WITH_PYDEBUG
@@ -676,25 +669,6 @@ public static extern int Py_Main(
676
669
[ DllImport ( PythonDll ) ]
677
670
internal static extern IntPtr PyEval_GetLocals( ) ;
678
671
679
- #if PYTHON3
680
- [ DllImport ( PythonDll ) ]
681
- internal static extern IntPtr Py_GetProgramName( ) ;
682
-
683
- [ DllImport ( PythonDll ) ]
684
- internal static extern void Py_SetProgramName ( IntPtr name ) ;
685
-
686
- [ DllImport ( PythonDll ) ]
687
- internal static extern IntPtr Py_GetPythonHome( ) ;
688
-
689
- [ DllImport ( PythonDll ) ]
690
- internal static extern void Py_SetPythonHome ( IntPtr home ) ;
691
-
692
- [ DllImport ( PythonDll ) ]
693
- internal static extern IntPtr Py_GetPath( ) ;
694
-
695
- [ DllImport ( PythonDll ) ]
696
- internal static extern void Py_SetPath ( IntPtr home ) ;
697
- #elif PYTHON2
698
672
[ DllImport ( PythonDll ) ]
699
673
internal static extern IntPtr Py_GetProgramName( ) ;
700
674
@@ -712,7 +686,6 @@ public static extern int Py_Main(
712
686
713
687
[ DllImport ( PythonDll ) ]
714
688
internal static extern void Py_SetPath ( IntPtr home ) ;
715
- #endif
716
689
717
690
[ DllImport ( PythonDll ) ]
718
691
internal static extern IntPtr Py_GetVersion( ) ;
@@ -781,20 +754,15 @@ internal static unsafe IntPtr PyObject_TYPE(IntPtr op)
781
754
#else
782
755
var n = 1 ;
783
756
#endif
784
- if ( Is32Bit )
785
- {
786
- return new IntPtr ( ( void * ) ( * ( ( uint * ) p + n) ) ) ;
787
- }
788
- else
789
- {
790
- return new IntPtr( ( void * ) ( * ( ( ulong * ) p + n) ) ) ;
791
- }
757
+ return Is32Bit
758
+ ? new IntPtr ( ( void * ) ( * ( ( uint * ) p + n) ) )
759
+ : new IntPtr( ( void * ) ( * ( ( ulong * ) p + n) ) ) ;
792
760
}
793
761
794
762
/// <summary>
795
763
/// Managed version of the standard Python C API PyObject_Type call.
796
- /// This version avoids a managed <-> unmanaged transition. This one
797
- /// does incref the returned type object.
764
+ /// This version avoids a managed <-> unmanaged transition.
765
+ /// This one does incref the returned type object.
798
766
/// </summary>
799
767
internal static IntPtr PyObject_Type( IntPtr op )
800
768
{
0 commit comments