8000 bpo-43239: Export PyCFunction_New with PyAPI_FUNC (GH-24551) · python/cpython@7bb1caf · GitHub
[go: up one dir, main page]

Skip to content

Commit 7bb1caf

Browse files
authored
bpo-43239: Export PyCFunction_New with PyAPI_FUNC (GH-24551)
1 parent 2d6f2ee commit 7bb1caf

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Include/methodobject.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ struct PyMethodDef {
4141
};
4242
typedef struct PyMethodDef PyMethodDef;
4343

44+
/* PyCFunction_New is declared as a function for stable ABI (declaration is
45+
* needed for e.g. GCC with -fvisibility=hidden), but redefined as a macro
46+
* that calls PyCFunction_NewEx. */
47+
PyAPI_FUNC(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *);
4448
#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
49+
50+
/* PyCFunction_NewEx is similar: on 3.9+, this calls PyCMethod_New. */
4551
PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
4652
PyObject *);
4753

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The :c:func:`PyCFunction_New` function is now exported in the ABI when
2+
compiled with ``-fvisibility=hidden``.

0 commit comments

Comments
 (0)
0