rest25/c-api/veryhigh.rst => rest262/c-api/veryhigh.rst
11file or a buffer, but they will not let you interact in a more detailed way with
12the interpreter.
13
14Several of these functions accept a start symbol from the grammar as a
15parameter.  The available start symbols are :const:`Py_eval_input`,
16:const:`Py_file_input`, and :const:`Py_single_input`.  These are described
17following the functions which accept them as parameters.
18
n19-Note also that several of these functions take :ctype:`FILE\*` parameters.  On
n19+Note also that several of these functions take :ctype:`FILE\*` parameters.  One
20particular issue which needs to be handled carefully is that the :ctype:`FILE`
21structure for different C libraries can be different and incompatible.  Under
22Windows (at least), it is possible for dynamically linked extensions to actually
23use different libraries, so care should be taken that :ctype:`FILE\*` parameters
24are only passed to these functions if it is certain that they were created by
25the same library that the Python runtime is using.
26
27
31   programs which embed Python.  The *argc* and *argv* parameters should be
32   prepared exactly as those which are passed to a C program's :cfunc:`main`
33   function.  It is important to note that the argument list may be modified (but
34   the contents of the strings pointed to by the argument list are not). The return
35   value will be the integer passed to the :func:`sys.exit` function, ``1`` if the
36   interpreter exits due to an exception, or ``2`` if the parameter list does not
37   represent a valid Python command line.
38
n39+   Note that if an otherwise unhandled :exc:`SystemError` is raised, this
40+   function will not return ``1``, but exit the process, as long as
41+   ``Py_InspectFlag`` is not set.
42+ 
39
40.. cfunction:: int PyRun_AnyFile(FILE *fp, const char *filename)
41
42   This is a simplified interface to :cfunc:`PyRun_AnyFileExFlags` below, leaving
43   *closeit* set to ``0`` and *flags* set to *NULL*.
44
45
46.. cfunction:: int PyRun_AnyFileFlags(FILE *fp, const char *filename, PyCompilerFlags *flags)
72
73.. cfunction:: int PyRun_SimpleStringFlags(const char *command, PyCompilerFlags *flags)
74
75   Executes the Python source code from *command* in the :mod:`__main__` module
76   according to the *flags* argument. If :mod:`__main__` does not already exist, it
77   is created.  Returns ``0`` on success or ``-1`` if an exception was raised.  If
78   there was an error, there is no way to get the exception information. For the
79   meaning of *flags*, see below.
n84+ 
85+   Note that if an otherwise unhandled :exc:`SystemError` is raised, this
86+   function will not return ``-1``, but exit the process, as long as
87+   ``Py_InspectFlag`` is not set.
80
81
82.. cfunction:: int PyRun_SimpleFile(FILE *fp, const char *filename)
83
84   This is a simplified interface to :cfunc:`PyRun_SimpleFileExFlags` below,
85   leaving *closeit* set to ``0`` and *flags* set to *NULL*.
86
87
224   object.  The start token is given by *start*; this can be used to constrain the
225   code which can be compiled and should be :const:`Py_eval_input`,
226   :const:`Py_file_input`, or :const:`Py_single_input`.  The filename specified by
227   *filename* is used to construct the code object and may appear in tracebacks or
228   :exc:`SyntaxError` exception messages.  This returns *NULL* if the code cannot
229   be parsed or compiled.
230
231
t240+.. cfunction:: PyObject* PyEval_EvalCode(PyCodeObject *co, PyObject *globals, PyObject *locals)
241+ 
242+   This is a simplified interface to :cfunc:`PyEval_EvalCodeEx`, with just
243+   the code object, and the dictionaries of global and local variables.
244+   The other arguments are set to *NULL*.
245+ 
246+ 
247+.. cfunction:: PyObject* PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argcount, PyObject **kws, int kwcount, PyObject **defs, int defcount, PyObject *closure)
248+ 
249+   Evaluate a precompiled code object, given a particular environment for its
250+   evaluation.  This environment consists of dictionaries of global and local
251+   variables, arrays of arguments, keywords and defaults, and a closure tuple of
252+   cells.
253+ 
254+ 
255+.. cfunction:: PyObject* PyEval_EvalFrame(PyFrameObject *f)
256+ 
257+   Evaluate an execution frame.  This is a simplified interface to
258+   PyEval_EvalFrameEx, for backward compatibility.
259+ 
260+ 
261+.. cfunction:: PyObject* PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
262+ 
263+   This is the main, unvarnished function of Python interpretation.  It is
264+   literally 2000 lines long.  The code object associated with the execution
265+   frame *f* is executed, interpreting bytecode and executing calls as needed.
266+   The additional *throwflag* parameter can mostly be ignored - if true, then
267+   it causes an exception to immediately be thrown; this is used for the
268+   :meth:`throw` methods of generator objects.
269+ 
270+ 
271+.. cfunction:: int PyEval_MergeCompilerFlags(PyCompilerFlags *cf)
272+ 
273+   This function changes the flags of the current evaluation frame, and returns
274+   true on success, false on failure.
275+ 
276+ 
232.. cvar:: int Py_eval_input
233
234   .. index:: single: Py_CompileString()
235
236   The start symbol from the Python grammar for isolated expressions; for use with
237   :cfunc:`Py_CompileString`.
238
239
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op