[Python-checkins] bpo-37189: Export old PyRun_XXX() functions (#14142)

Victor Stinner webhook-mailer at python.org
Mon Jun 17 18:15:17 EDT 2019


https://github.com/python/cpython/commit/343ed0ffe0d5ddd4f17c31e14a656a04ac7dfc19
commit: 343ed0ffe0d5ddd4f17c31e14a656a04ac7dfc19
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2019-06-18T00:15:13+02:00
summary:

bpo-37189: Export old PyRun_XXX() functions (#14142)

Many PyRun_XXX() functions like PyRun_String() were no longer
exported in libpython38.dll by mistake. Export them again to fix the
ABI compatibiliy.

files:
A Misc/NEWS.d/next/Build/2019-06-17-09-40-59.bpo-37189.j5ebdT.rst
M Include/pythonrun.h

diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index 196355cb8f40..46091e092163 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -9,7 +9,6 @@ extern "C" {
 
 #ifndef Py_LIMITED_API
 PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
-PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
 PyAPI_FUNC(int) PyRun_AnyFileExFlags(
     FILE *fp,
     const char *filename,       /* decoded from the filesystem encoding */
@@ -122,7 +121,7 @@ PyAPI_FUNC(struct symtable *) Py_SymtableString(
 PyAPI_FUNC(const char *) _Py_SourceAsString(
     PyObject *cmd,
     const char *funcname,
-    const char *what, 
+    const char *what,
     PyCompilerFlags *cf,
     PyObject **cmd_copy);
 
@@ -143,6 +142,23 @@ PyAPI_FUNC(void) PyErr_PrintEx(int);
 PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);
 
 #ifndef Py_LIMITED_API
+/* A function flavor is also exported by libpython. It is required when
+    libpython is accessed directly rather than using header files which defines
+    macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to
+    export functions in pythonXX.dll. */
+PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l);
+PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name);
+PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit);
+PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
+PyAPI_FUNC(int) PyRun_SimpleString(const char *s);
+PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p);
+PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c);
+PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p);
+PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p);
+PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l);
+PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c);
+PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags);
+
 /* Use macros for a bunch of old variants */
 #define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
 #define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
diff --git a/Misc/NEWS.d/next/Build/2019-06-17-09-40-59.bpo-37189.j5ebdT.rst b/Misc/NEWS.d/next/Build/2019-06-17-09-40-59.bpo-37189.j5ebdT.rst
new file mode 100644
index 000000000000..f11f2746e5a0
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2019-06-17-09-40-59.bpo-37189.j5ebdT.rst
@@ -0,0 +1,3 @@
+Many ``PyRun_XXX()`` functions like :c:func:`PyRun_String` were no longer
+exported in ``libpython38.dll`` by mistake. Export them again to fix the ABI
+compatibiliy.



More information about the Python-checkins mailing list