PyObject_SetItem() private method

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

            if (r < 0)
            {
                throw new PythonException();
            }
        }
Esempio n. 2
0
 private void Set(string name, IntPtr value)
 {
     Check();
     using (var pyKey = new PyString(name))
     {
         int r = Runtime.PyObject_SetItem(variables, pyKey.obj, value);
         if (r < 0)
         {
             throw new PythonException();
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// SetItem Method
        /// </summary>
        /// <remarks>
        /// For objects that support the Python sequence or mapping protocols,
        /// set the item at the given object index to the given value. This
        /// method raises a PythonException if the set operation fails.
        /// </remarks>
        public virtual void SetItem(PyObject key, PyObject value)
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            int r = Runtime.PyObject_SetItem(obj, key.obj, value.obj);

            if (r < 0)
            {
                throw new PythonException();
            }
        }