Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0041a94e
Commit
0041a94e
authored
Apr 29, 1999
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fill in a few holes in the "Very High Level" chapter.
parent
5f342ac2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
Doc/api/api.tex
Doc/api/api.tex
+37
-0
No files found.
Doc/api/api.tex
View file @
0041a94e
...
...
@@ -552,12 +552,25 @@ given in a file or a buffer, but they will not let you interact in a
more detailed way with the interpreter.
\begin{cfuncdesc}
{
int
}{
PyRun
_
AnyFile
}{
FILE *fp, char *filename
}
If
\var
{
fp
}
refers to a file associated with an interactive device
(console or terminal input or
\UNIX
{}
pseudo-terminal), return the
value of
\cfunction
{
PyRun
_
InteractiveLoop()
}
, otherwise return the
result of
\cfunction
{
PyRun
_
SimpleFile()
}
. If
\var
{
filename
}
is
\NULL
{}
, use
\code
{
"???"
}
as the filename.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyRun
_
SimpleString
}{
char *command
}
Executes the Python source code from
\var
{
command
}
in the
\module
{__
main
__}
module. If
\module
{__
main
__}
does not already
exist, it is created. Returns
\code
{
0
}
on success or
\code
{
-1
}
if
an exception was raised. If there was an error, there is no way to
get the exception information.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyRun
_
SimpleFile
}{
FILE *fp, char *filename
}
Similar to
\cfunction
{
PyRun
_
SimpleString()
}
, but the Python source
code is read from
\var
{
fp
}
instead of an in-memory string.
\var
{
filename
}
should be the name of the file.
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyRun
_
InteractiveOne
}{
FILE *fp, char *filename
}
...
...
@@ -568,24 +581,48 @@ more detailed way with the interpreter.
\begin{cfuncdesc}
{
struct
_
node*
}{
PyParser
_
SimpleParseString
}{
char *str,
int start
}
Parse Python source code from
\var
{
str
}
using the start token
\var
{
start
}
. The result can be used to create a code object which
can be evaluated efficiently. This is useful if a code fragment
must be evaluated many times.
\end{cfuncdesc}
\begin{cfuncdesc}
{
struct
_
node*
}{
PyParser
_
SimpleParseFile
}{
FILE *fp,
char *filename, int start
}
Similar to
\cfunction
{
PyParser
_
SimpleParseString()
}
, but the Python
source code is read from
\var
{
fp
}
instead of an in-memory string.
\var
{
filename
}
should be the name of the file.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyRun
_
String
}{
char *str, int start,
PyObject *globals,
PyObject *locals
}
Execute Python source code from
\var
{
str
}
in the context specified
by the dictionaries
\var
{
globals
}
and
\var
{
locals
}
. The parameter
\var
{
start
}
specifies the start token that should be used to parse
the source code.
Returns the result of executing the code as a Python object, or
\NULL
{}
if an exception was raised.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyRun
_
File
}{
FILE *fp, char *filename,
int start, PyObject *globals,
PyObject *locals
}
Similar to
\cfunction
{
PyRun
_
String()
}
, but the Python source code is
read from
\var
{
fp
}
instead of an in-memory string.
\var
{
filename
}
should be the name of the file.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
Py
_
CompileString
}{
char *str, char *filename,
int start
}
Parse and compile the Python source code in
\var
{
str
}
, returning the
resulting code object. The start token is given by
\var
{
start
}
;
this can be used to constrain the code which can be compiled. The
filename specified by
\var
{
filename
}
is used to construct the code
object and may appear in tracebacks or
\exception
{
SyntaxError
}
exception messages. This returns
\NULL
{}
if the code cannot be
parsed or compiled.
\end{cfuncdesc}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment