@@ -565,18 +565,11 @@ internal static unsafe void XDecref(IntPtr op)
565565 internal static unsafe long Refcount( IntPtr op )
566566 {
567567 var p = ( void * ) op ;
568- if ( ( void * ) 0 ! = p )
568+ if ( ( void * ) 0 = = p )
569569 {
570- if ( Is32Bit )
571- {
572- return ( * ( int * ) p ) ;
573- }
574- else
575- {
576- return ( * ( long * ) p ) ;
577- }
570+ return 0 ;
578571 }
579- return 0 ;
572+ return Is32Bit ? ( * ( int * ) p ) : ( * ( long * ) p ) ;
580573 }
581574
582575#if PYTHON_WITH_PYDEBUG
@@ -676,25 +669,6 @@ public static extern int Py_Main(
676669 [ DllImport ( PythonDll ) ]
677670 internal static extern IntPtr PyEval_GetLocals( ) ;
678671
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
698672 [ DllImport ( PythonDll ) ]
699673 internal static extern IntPtr Py_GetProgramName( ) ;
700674
@@ -712,7 +686,6 @@ public static extern int Py_Main(
712686
713687 [ DllImport ( PythonDll ) ]
714688 internal static extern void Py_SetPath ( IntPtr home ) ;
715- #endif
716689
717690 [ DllImport ( PythonDll ) ]
718691 internal static extern IntPtr Py_GetVersion( ) ;
@@ -781,20 +754,15 @@ internal static unsafe IntPtr PyObject_TYPE(IntPtr op)
781754#else
782755 var n = 1 ;
783756#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) ) ) ;
792760 }
793761
794762 /// <summary>
795763 /// 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.
798766 /// </summary>
799767 internal static IntPtr PyObject_Type( IntPtr op )
800768 {
0 commit comments