public static IntPtr tp_descr_get(IntPtr ds, IntPtr ob, IntPtr tp) {
MethodObject self = (MethodObject)GetManagedObject(ds);
MethodBinding binding;
// If the method is accessed through its type (rather than via
// an instance) we return an 'unbound' MethodBinding that will
// cached for future accesses through the type.
if (ob == IntPtr.Zero) {
if (self.unbound == null) {
self.unbound = new MethodBinding(self, IntPtr.Zero);
}
binding = self.unbound;
Runtime.Incref(binding.pyHandle);;
return binding.pyHandle;
}
if (Runtime.PyObject_IsInstance(ob, tp) < 1) {
return Exceptions.RaiseTypeError("invalid argument");
}
binding = new MethodBinding(self, ob);
return binding.pyHandle;
}