@@ -552,12 +552,25 @@ \chapter{The Very High Level Layer \label{veryhigh}}
552552more detailed way with the interpreter.
553553
554554\begin {cfuncdesc }{int}{PyRun_AnyFile}{FILE *fp, char *filename}
555+ If \var {fp} refers to a file associated with an interactive device
556+ (console or terminal input or \UNIX {} pseudo-terminal), return the
557+ value of \cfunction {PyRun_InteractiveLoop()}, otherwise return the
558+ result of \cfunction {PyRun_SimpleFile()}. If \var {filename} is
559+ \NULL {}, use \code {"???"} as the filename.
555560\end {cfuncdesc }
556561
557562\begin {cfuncdesc }{int}{PyRun_SimpleString}{char *command}
563+ Executes the Python source code from \var {command} in the
564+ \module {__main__} module. If \module {__main__} does not already
565+ exist, it is created. Returns \code {0} on success or \code {-1} if
566+ an exception was raised. If there was an error, there is no way to
567+ get the exception information.
558568\end {cfuncdesc }
559569
560570\begin {cfuncdesc }{int}{PyRun_SimpleFile}{FILE *fp, char *filename}
571+ Similar to \cfunction {PyRun_SimpleString()}, but the Python source
572+ code is read from \var {fp} instead of an in-memory string.
573+ \var {filename} should be the name of the file.
561574\end {cfuncdesc }
562575
563576\begin {cfuncdesc }{int}{PyRun_InteractiveOne}{FILE *fp, char *filename}
@@ -568,24 +581,48 @@ \chapter{The Very High Level Layer \label{veryhigh}}
568581
569582\begin {cfuncdesc }{struct _node*}{PyParser_SimpleParseString}{char *str,
570583 int start}
584+ Parse Python source code from \var {str} using the start token
585+ \var {start}. The result can be used to create a code object which
586+ can be evaluated efficiently. This is useful if a code fragment
587+ must be evaluated many times.
571588\end {cfuncdesc }
572589
573590\begin {cfuncdesc }{struct _node*}{PyParser_SimpleParseFile}{FILE *fp,
574591 char *filename, int start}
592+ Similar to \cfunction {PyParser_SimpleParseString()}, but the Python
593+ source code is read from \var {fp} instead of an in-memory string.
594+ \var {filename} should be the name of the file.
575595\end {cfuncdesc }
576596
577597\begin {cfuncdesc }{PyObject*}{PyRun_String}{char *str, int start,
578598 PyObject *globals,
579599 PyObject *locals}
600+ Execute Python source code from \var {str} in the context specified
601+ by the dictionaries \var {globals} and \var {locals}. The parameter
602+ \var {start} specifies the start token that should be used to parse
603+ the source code.
604+
605+ Returns the result of executing the code as a Python object, or
606+ \NULL {} if an exception was raised.
580607\end {cfuncdesc }
581608
582609\begin {cfuncdesc }{PyObject*}{PyRun_File}{FILE *fp, char *filename,
583610 int start, PyObject *globals,
584611 PyObject *locals}
612+ Similar to \cfunction {PyRun_String()}, but the Python source code is
613+ read from \var {fp} instead of an in-memory string. \var {filename}
614+ should be the name of the file.
585615\end {cfuncdesc }
586616
587617\begin {cfuncdesc }{PyObject*}{Py_CompileString}{char *str, char *filename,
588618 int start}
619+ Parse and compile the Python source code in \var {str}, returning the
620+ resulting code object. The start token is given by \var {start};
621+ this can be used to constrain the code which can be compiled. The
622+ filename specified by \var {filename} is used to construct the code
623+ object and may appear in tracebacks or \exception {SyntaxError}
624+ exception messages. This returns \NULL {} if the code cannot be
625+ parsed or compiled.
589626\end {cfuncdesc }
590627
591628
0 commit comments