]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43239: Export PyCFunction_New with PyAPI_FUNC (GH-24551)
authorPetr Viktorin <encukou@gmail.com>
Tue, 23 Feb 2021 12:23:56 +0000 (13:23 +0100)
committerGitHub <noreply@github.com>
Tue, 23 Feb 2021 12:23:56 +0000 (13:23 +0100)
Include/methodobject.h
Misc/NEWS.d/next/C API/2021-02-16-17-30-16.bpo-43239.FQqOGz.rst [new file with mode: 0644]

index 5d06d7691ba324a2f6474fa7e848bba91567bd43..7aa4e41ccca1fe1c59ed74227c53ec2556e907d2 100644 (file)
@@ -41,7 +41,13 @@ struct PyMethodDef {
 };
 typedef struct PyMethodDef PyMethodDef;
 
+/* PyCFunction_New is declared as a function for stable ABI (declaration is
+ * needed for e.g. GCC with -fvisibility=hidden), but redefined as a macro
+ * that calls PyCFunction_NewEx. */
+PyAPI_FUNC(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *);
 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
+
+/* PyCFunction_NewEx is similar: on 3.9+, this calls PyCMethod_New. */
 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
                                          PyObject *);
 
diff --git a/Misc/NEWS.d/next/C API/2021-02-16-17-30-16.bpo-43239.FQqOGz.rst b/Misc/NEWS.d/next/C API/2021-02-16-17-30-16.bpo-43239.FQqOGz.rst
new file mode 100644 (file)
index 0000000..cded580
--- /dev/null
@@ -0,0 +1,2 @@
+The :c:func:`PyCFunction_New` function is now exported in the ABI when
+compiled with ``-fvisibility=hidden``.