PyObject_GetItem() private method

private PyObject_GetItem ( IntPtr pointer, IntPtr key ) : IntPtr
pointer IntPtr
key IntPtr
return IntPtr
Esempio n. 1
0
        /// <summary>
        /// GetItem Method
        /// </summary>
        /// <remarks>
        /// For objects that support the Python sequence or mapping protocols,
        /// return the item at the given object index. This method raises a
        /// PythonException if the indexing operation fails.
        /// </remarks>
        public virtual PyObject GetItem(PyObject key)
        {
            IntPtr op = Runtime.PyObject_GetItem(obj, key.obj);

            if (op == IntPtr.Zero)
            {
                throw new PythonException();
            }
            return(new PyObject(op));
        }
Esempio n. 2
0
        /// <summary>
        /// GetItem Method
        /// </summary>
        /// <remarks>
        /// For objects that support the Python sequence or mapping protocols,
        /// return the item at the given object index. This method raises a
        /// PythonException if the indexing operation fails.
        /// </remarks>
        public virtual PyObject GetItem(PyObject key)
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            IntPtr op = Runtime.PyObject_GetItem(obj, key.obj);

            if (op == IntPtr.Zero)
            {
                throw new PythonException();
            }
            return(new PyObject(op));
        }