Skip to content
Prev Previous commit
Next Next commit
Use IntPtr.Zero instead of null for comparisons with IntPtrs
  • Loading branch information
Rickard Holmberg committed Jun 15, 2017
commit a21f5cff0d154c861430b976cc7ef1a0b86f2d89
4 changes: 2 additions & 2 deletions src/runtime/runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ internal static bool PyObject_IsIterable(IntPtr pointer)
return false;
#endif
IntPtr tp_iter = Marshal.ReadIntPtr(ob_type, TypeOffset.tp_iter);
return tp_iter != null;
return tp_iter != IntPtr.Zero;
}

[DllImport(PythonDll, CallingConvention = CallingConvention.Cdecl)]
Expand Down Expand Up @@ -1449,7 +1449,7 @@ internal static bool PyIter_Check(IntPtr pointer)
return false;
#endif
IntPtr tp_iternext = Marshal.ReadIntPtr(ob_type, TypeOffset.tp_iternext);
return tp_iternext != null && tp_iternext != _PyObject_NextNotImplemented;
return tp_iternext != IntPtr.Zero && tp_iternext != _PyObject_NextNotImplemented;
}

[DllImport(PythonDll, CallingConvention = CallingConvention.Cdecl)]
Expand Down