PyObject_Size() private method

private PyObject_Size ( IntPtr pointer ) : int
pointer IntPtr
return int
コード例 #1
0
ファイル: pyobject.cs プロジェクト: hua124365/pythonnet
        /// <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);
        }
コード例 #2
0
ファイル: pyobject.cs プロジェクト: wangrui523/pythonnet
        /// <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);
        }