Example #1
0
        /// <summary>
        /// Invoke Method
        /// </summary>
        /// <remarks>
        /// Invoke the callable object with the given positional and keyword
        /// arguments. A PythonException is raised if the invokation fails.
        /// </remarks>
        public PyObject Invoke(PyObject[] args, PyDict kw)
        {
            var    t = new PyTuple(args);
            IntPtr r = Runtime.PyObject_Call(obj, t.obj, kw != null ? kw.obj : IntPtr.Zero);

            t.Dispose();
            if (r == IntPtr.Zero)
            {
                throw new PythonException();
            }
            return(new PyObject(r));
        }
Example #2
0
        /// <summary>
        /// Invoke Method
        /// </summary>
        /// <remarks>
        /// Invoke the callable object with the given arguments, passed as a
        /// PyObject[]. A PythonException is raised if the invokation fails.
        /// </remarks>
        public PyObject Invoke(params PyObject[] args)
        {
            var    t = new PyTuple(args);
            IntPtr r = Runtime.PyObject_Call(obj, t.obj, IntPtr.Zero);

            t.Dispose();
            if (r == IntPtr.Zero)
            {
                throw new PythonException();
            }
            return(new PyObject(r));
        }