Python.Runtime.MethodBinding.tp_call C# (CSharp) Method

tp_call() private method

private tp_call ( IntPtr ob, IntPtr args, IntPtr kw ) : IntPtr
ob System.IntPtr
args System.IntPtr
kw System.IntPtr
return System.IntPtr
	public static IntPtr tp_call(IntPtr ob, IntPtr args, IntPtr kw) {
	    MethodBinding self = (MethodBinding)GetManagedObject(ob);

	    // This supports calling a method 'unbound', passing the instance
	    // as the first argument. Note that this is not supported if any
	    // of the overloads are static since we can't know if the intent
	    // was to call the static method or the unbound instance method.

	    if ((self.target == IntPtr.Zero) && (!self.m.IsStatic())) {
		if (Runtime.PyTuple_Size(args) < 1) {
		    Exceptions.SetError(Exceptions.TypeError, 
					"not enough arguments"
					);
		    return IntPtr.Zero;
		}
		int len = Runtime.PyTuple_Size(args);
		IntPtr uargs = Runtime.PyTuple_GetSlice(args, 1, len);
		IntPtr inst = Runtime.PyTuple_GetItem(args, 0);
		Runtime.Incref(inst);
		IntPtr r = self.m.Invoke(inst, uargs, kw, self.info);
		Runtime.Decref(inst);
		Runtime.Decref(uargs);
		return r;
	    }

	    return self.m.Invoke(self.target, args, kw, self.info);
	}