PyObject_Size() private method

private PyObject_Size ( IntPtr pointer ) : int
pointer IntPtr
return int
Esempio n. 1
0
        /// <summary>
        /// Returns the length for objects that support the Python sequence
        /// protocol.
        /// </summary>
        public virtual long Length()
        {
            var s = Runtime.PyObject_Size(Reference);

            if (s < 0)
            {
                throw new PythonException();
            }
            return(s);
        }
Esempio n. 2
0
        /// <summary>
        /// Length Method
        /// </summary>
        /// <remarks>
        /// Returns the length for objects that support the Python sequence
        /// protocol, or 0 if the object does not support the protocol.
        /// </remarks>
        public virtual int Length()
        {
            int s = Runtime.PyObject_Size(obj);

            if (s < 0)
            {
                Runtime.PyErr_Clear();
                return(0);
            }
            return(s);
        }