1#ifndef Py_CPYTHON_PYTHONRUN_H
2# error "this header file must not be included directly"
3#endif
4
5PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
6PyAPI_FUNC(int) _PyRun_SimpleFileObject(
7 FILE *fp,
8 PyObject *filename,
9 int closeit,
10 PyCompilerFlags *flags);
11PyAPI_FUNC(int) PyRun_AnyFileExFlags(
12 FILE *fp,
13 const char *filename, /* decoded from the filesystem encoding */
14 int closeit,
15 PyCompilerFlags *flags);
16PyAPI_FUNC(int) _PyRun_AnyFileObject(
17 FILE *fp,
18 PyObject *filename,
19 int closeit,
20 PyCompilerFlags *flags);
21PyAPI_FUNC(int) PyRun_SimpleFileExFlags(
22 FILE *fp,
23 const char *filename, /* decoded from the filesystem encoding */
24 int closeit,
25 PyCompilerFlags *flags);
26PyAPI_FUNC(int) PyRun_InteractiveOneFlags(
27 FILE *fp,
28 const char *filename, /* decoded from the filesystem encoding */
29 PyCompilerFlags *flags);
30PyAPI_FUNC(int) PyRun_InteractiveOneObject(
31 FILE *fp,
32 PyObject *filename,
33 PyCompilerFlags *flags);
34PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(
35 FILE *fp,
36 const char *filename, /* decoded from the filesystem encoding */
37 PyCompilerFlags *flags);
38PyAPI_FUNC(int) _PyRun_InteractiveLoopObject(
39 FILE *fp,
40 PyObject *filename,
41 PyCompilerFlags *flags);
42
43
44PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
45 PyObject *, PyCompilerFlags *);
46
47PyAPI_FUNC(PyObject *) PyRun_FileExFlags(
48 FILE *fp,
49 const char *filename, /* decoded from the filesystem encoding */
50 int start,
51 PyObject *globals,
52 PyObject *locals,
53 int closeit,
54 PyCompilerFlags *flags);
55
56
57PyAPI_FUNC(PyObject *) Py_CompileStringExFlags(
58 const char *str,
59 const char *filename, /* decoded from the filesystem encoding */
60 int start,
61 PyCompilerFlags *flags,
62 int optimize);
63PyAPI_FUNC(PyObject *) Py_CompileStringObject(
64 const char *str,
65 PyObject *filename, int start,
66 PyCompilerFlags *flags,
67 int optimize);
68
69#define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1)
70#define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags(str, p, s, f, -1)
71
72
73PyAPI_FUNC(const char *) _Py_SourceAsString(
74 PyObject *cmd,
75 const char *funcname,
76 const char *what,
77 PyCompilerFlags *cf,
78 PyObject **cmd_copy);
79
80
81/* A function flavor is also exported by libpython. It is required when
82 libpython is accessed directly rather than using header files which defines
83 macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to
84 export functions in pythonXX.dll. */
85PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l);
86PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name);
87PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit);
88PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
89PyAPI_FUNC(int) PyRun_SimpleString(const char *s);
90PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p);
91PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c);
92PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p);
93PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p);
94PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l);
95PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c);
96PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags);
97
98/* Use macros for a bunch of old variants */
99#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
100#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
101#define PyRun_AnyFileEx(fp, name, closeit) \
102 PyRun_AnyFileExFlags(fp, name, closeit, NULL)
103#define PyRun_AnyFileFlags(fp, name, flags) \
104 PyRun_AnyFileExFlags(fp, name, 0, flags)
105#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
106#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
107#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL)
108#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL)
109#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
110#define PyRun_File(fp, p, s, g, l) \
111 PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
112#define PyRun_FileEx(fp, p, s, g, l, c) \
113 PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
114#define PyRun_FileFlags(fp, p, s, g, l, flags) \
115 PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
116
117
118/* Stuff with no proper home (yet) */
119PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
120PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
121PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);
122

source code of include/python3.10/cpython/pythonrun.h