public static IntPtr tp_call(IntPtr ob, IntPtr args, IntPtr kw) {
ManagedType self = GetManagedObject(ob);
IntPtr tp = Runtime.PyObject_TYPE(ob);
ClassBase cb = (ClassBase)GetManagedObject(tp);
if (cb.type != typeof(System.Delegate)) {
Exceptions.SetError(Exceptions.TypeError,
"object is not callable");
return IntPtr.Zero;
}
CLRObject co = (CLRObject)ManagedType.GetManagedObject(ob);
Delegate d = co.inst as Delegate;
BindingFlags flags = BindingFlags.Public |
BindingFlags.NonPublic |
BindingFlags.Instance |
BindingFlags.Static;
MethodInfo method = d.GetType().GetMethod("Invoke", flags);
MethodBinder binder = new MethodBinder(method);
return binder.Invoke(ob, args, kw);
}