Python.Runtime.ConstructorBinding.tp_descr_get C# (CSharp) Метод

tp_descr_get() публичный статический Метод

Descriptor __get__ implementation. Implements a Python type that wraps a CLR ctor call that requires the use of a .Overloads[pyTypeOrType...] syntax to allow explicit ctor overload selection.
Python 2.6.5 docs: object.__get__(self, instance, owner) Called to get the attribute of the owner class (class attribute access) or of an instance of that class (instance attribute access). owner is always the owner class, while instance is the instance that the attribute was accessed through, or None when the attribute is accessed through the owner. This method should return the (computed) attribute value or raise an AttributeError exception.
public static tp_descr_get ( IntPtr op, IntPtr instance, IntPtr owner ) : IntPtr
op System.IntPtr PyObject* to a Constructors wrapper
instance System.IntPtr the instance that the attribute was accessed through, /// or None when the attribute is accessed through the owner
owner System.IntPtr always the owner class
Результат System.IntPtr
        public static IntPtr tp_descr_get(IntPtr op, IntPtr instance, IntPtr owner)
        {
            ConstructorBinding self = (ConstructorBinding)GetManagedObject(op);
            if (self == null)
            {
                return IntPtr.Zero;
            }

            // It doesn't seem to matter if it's accessed through an instance (rather than via the type).
            /*if (instance != IntPtr.Zero) {
            // This is ugly! PyObject_IsInstance() returns 1 for true, 0 for false, -1 for error...
                if (Runtime.PyObject_IsInstance(instance, owner) < 1) {
                    return Exceptions.RaiseTypeError("How in the world could that happen!");
                }
            }*/
            Runtime.XIncref(self.pyHandle); // Decref'd by the interpreter.
            return self.pyHandle;
        }