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

public static tp_str ( IntPtr ob ) : IntPtr
ob System.IntPtr
Результат System.IntPtr
Пример #1
0
        //====================================================================
        // Exceptions __getattribute__ implementation.
        // handles Python's args and message attributes
        //====================================================================

        public static IntPtr tp_getattro(IntPtr ob, IntPtr key)
        {
            if (!Runtime.PyString_Check(key))
            {
                Exceptions.SetError(Exceptions.TypeError, "string expected");
                return(IntPtr.Zero);
            }

            string name = Runtime.GetManagedString(key);

            if (name == "args")
            {
                Exception e = ToException(ob);
                IntPtr    args;
                if (e.Message != String.Empty)
                {
                    args = Runtime.PyTuple_New(1);
                    IntPtr msg = Runtime.PyUnicode_FromString(e.Message);
                    Runtime.PyTuple_SetItem(args, 0, msg);
                }
                else
                {
                    args = Runtime.PyTuple_New(0);
                }
                return(args);
            }

            if (name == "message")
            {
                return(ExceptionClassObject.tp_str(ob));
            }

            return(Runtime.PyObject_GenericGetAttr(ob, key));
        }