bpo-37189: Export old PyRun_XXX() functions (#14142) · python/cpython@343ed0f
@@ -9,7 +9,6 @@ extern "C" {
991010#ifndef Py_LIMITED_API
1111PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
12-PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
1312PyAPI_FUNC(int) PyRun_AnyFileExFlags(
1413FILE *fp,
1514const char *filename, /* decoded from the filesystem encoding */
@@ -122,7 +121,7 @@ PyAPI_FUNC(struct symtable *) Py_SymtableString(
122121PyAPI_FUNC(const char *) _Py_SourceAsString(
123122PyObject *cmd,
124123const char *funcname,
125-const char *what,
124+const char *what,
126125PyCompilerFlags *cf,
127126PyObject **cmd_copy);
128127@@ -143,6 +142,23 @@ PyAPI_FUNC(void) PyErr_PrintEx(int);
143142PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);
144143145144#ifndef Py_LIMITED_API
145+/* A function flavor is also exported by libpython. It is required when
146+ libpython is accessed directly rather than using header files which defines
147+ macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to
148+ export functions in pythonXX.dll. */
149+PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l);
150+PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name);
151+PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit);
152+PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
153+PyAPI_FUNC(int) PyRun_SimpleString(const char *s);
154+PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p);
155+PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c);
156+PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p);
157+PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p);
158+PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l);
159+PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c);
160+PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags);
161+146162/* Use macros for a bunch of old variants */
147163#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
148164#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)