Exemple #1
0
        private void Exec(string code, IntPtr _globals, IntPtr _locals)
        {
            var          flag      = (IntPtr)Runtime.Py_file_input;
            NewReference reference = Runtime.PyRun_String(
                code, flag, _globals, _locals
                );

            try
            {
                Runtime.CheckExceptionOccurred();
                if (!reference.IsNone())
                {
                    throw new PythonException();
                }
            }
            finally
            {
                reference.Dispose();
            }
        }