@@ -115,7 +115,7 @@ public class Runtime
115
115
#elif PYTHON36
116
116
public const string pyversion = "3.6" ;
117
117
public const string pyver = "36" ;
118
- #elif PYTHON37 // TODO: Add interop37 after Python3.7 is released
118
+ #elif PYTHON37 // TODO: Add ` interop37.cs` after PY37 is released
119
119
public const string pyversion = "3.7" ;
120
120
public const string pyver = "37" ;
121
121
#else
@@ -154,7 +154,7 @@ public class Runtime
154
154
155
155
// set to true when python is finalizing
156
156
internal static object IsFinalizingLock = new object ( ) ;
157
- internal static bool IsFinalizing = false ;
157
+ internal static bool IsFinalizing ;
158
158
159
159
internal static bool Is32Bit ;
160
160
internal static bool IsPython2 ;
@@ -401,7 +401,7 @@ internal static IntPtr GetBoundArgTuple(IntPtr obj, IntPtr args)
401
401
PyTuple_SetItem ( items , 0 , obj ) ;
402
402
XIncref ( obj ) ;
403
403
404
- for ( int i = 0 ; i < size ; i ++ )
404
+ for ( var i = 0 ; i < size ; i ++ )
405
405
{
406
406
IntPtr item = PyTuple_GetItem ( args , i ) ;
407
407
XIncref ( item ) ;
@@ -419,14 +419,14 @@ internal static IntPtr ExtendTuple(IntPtr t, params IntPtr[] args)
419
419
IntPtr item ;
420
420
421
421
IntPtr items = PyTuple_New ( size + add ) ;
422
- for ( int i = 0 ; i < size ; i ++ )
422
+ for ( var i = 0 ; i < size ; i ++ )
423
423
{
424
424
item = PyTuple_GetItem ( t , i ) ;
425
425
XIncref ( item ) ;
426
426
PyTuple_SetItem ( items , i , item ) ;
427
427
}
428
428
429
- for ( int n = 0 ; n < add ; n ++ )
429
+ for ( var n = 0 ; n < add ; n ++ )
430
430
{
431
431
item = args [ n ] ;
432
432
XIncref ( item ) ;
@@ -447,7 +447,7 @@ internal static Type[] PythonArgsToTypeArray(IntPtr arg, bool mangleObjects)
447
447
// tuple of (managed or unmanaged) type objects, return a Type[]
448
448
// containing the CLR Type objects that map to those types.
449
449
IntPtr args = arg ;
450
- bool free = false ;
450
+ var free = false ;
451
451
452
452
if ( ! PyTuple_Check ( arg ) )
453
453
{
@@ -458,10 +458,10 @@ internal static Type[] PythonArgsToTypeArray(IntPtr arg, bool mangleObjects)
458
458
}
459
459
460
460
int n = PyTuple_Size ( args ) ;
461
- Type [ ] types = new Type [ n ] ;
461
+ var types = new Type [ n ] ;
462
462
Type t = null ;
463
463
464
- for ( int i = 0 ; i < n ; i ++ )
464
+ for ( var i = 0 ; i < n ; i ++ )
465
465
{
466
466
IntPtr op = PyTuple_GetItem ( args , i ) ;
467
467
if ( mangleObjects && ( ! PyType_Check ( op ) ) )
@@ -513,7 +513,7 @@ internal static unsafe void XIncref(IntPtr op)
513
513
Py_IncRef ( op ) ;
514
514
return ;
515
515
#else
516
- void * p = ( void * ) op ;
516
+ var p = ( void * ) op ;
517
517
if ( ( void * ) 0 != p )
518
518
{
519
519
if ( Is32Bit )
@@ -536,7 +536,7 @@ internal static unsafe void XDecref(IntPtr op)
536
536
Py_DecRef ( op ) ;
537
537
return ;
538
538
#else
539
- void * p = ( void * ) op ;
539
+ var p = ( void * ) op ;
540
540
if ( ( void * ) 0 != p )
541
541
{
542
542
if ( Is32Bit )
@@ -562,15 +562,14 @@ internal static unsafe void XDecref(IntPtr op)
562
562
return ;
563
563
}
564
564
NativeCall . Impl . Void_Call_1 ( new IntPtr ( f ) , op ) ;
565
- return ;
566
565
}
567
566
}
568
567
#endif
569
568
}
570
569
571
570
internal static unsafe long Refcount( IntPtr op )
572
571
{
573
- void * p = ( void * ) op ;
572
+ var p = ( void * ) op ;
574
573
if ( ( void * ) 0 != p )
575
574
{
576
575
if ( Is32Bit )
@@ -786,15 +785,15 @@ internal static extern void Py_SetPath(
786
785
/// </summary>
787
786
internal static unsafe IntPtr PyObject_TYPE( IntPtr op )
788
787
{
789
- void * p = ( void * ) op ;
788
+ var p = ( void * ) op ;
790
789
if ( ( void * ) 0 == p)
791
790
{
792
791
return IntPtr . Zero ;
793
792
}
794
793
#if Py_DEBUG
795
- int n = 3 ;
794
+ var n = 3 ;
796
795
#else
797
- int n = 1 ;
796
+ var n = 1 ;
798
797
#endif
799
798
if ( Is32Bit )
800
799
{
@@ -966,13 +965,13 @@ internal static bool PyBool_Check(IntPtr ob)
966
965
967
966
internal static IntPtr PyInt_FromInt32( int value )
968
967
{
969
- IntPtr v = new IntPtr( value) ;
968
+ var v = new IntPtr( value ) ;
970
969
return PyInt_FromLong( v) ;
971
970
}
972
971
973
972
internal static IntPtr PyInt_FromInt64( long value )
974
973
{
975
- IntPtr v = new IntPtr( value) ;
974
+ var v = new IntPtr( value ) ;
976
975
return PyInt_FromLong( v) ;
977
976
}
978
977
@@ -1285,7 +1284,7 @@ int size
1285
1284
1286
1285
internal static IntPtr PyUnicode_FromString( string s)
1287
1286
{
1288
- return PyUnicode_FromUnicode( s, ( s . Length ) ) ;
1287
+ return PyUnicode_FromUnicode( s, s . Length ) ;
1289
1288
}
1290
1289
1291
1290
/// <summary>
@@ -1463,7 +1462,7 @@ internal static bool PyTuple_Check(IntPtr ob)
1463
1462
#elif PYTHON3
1464
1463
internal static bool PyIter_Check( IntPtr pointer)
1465
1464
{
1466
- IntPtr ob_type = ( IntPtr) Marshal . PtrToStructure ( pointer + ObjectOffset . ob_type , typeof ( IntPtr ) ) ;
1465
+ var ob_type = ( IntPtr) Marshal. PtrToStructure( pointer + ObjectOffset. ob_type, typeof ( IntPtr ) ) ;
1467
1466
IntPtr tp_iternext = ob_type + TypeOffset. tp_iternext;
1468
1467
return tp_iternext != null && tp_iternext != _PyObject_NextNotImplemented;
1469
1468
}
0 commit comments