Skip to content

Commit

Permalink
bpo-43239: Export PyCFunction_New with PyAPI_FUNC (pythonGH-24551)
Browse files Browse the repository at this point in the history
  • Loading branch information
encukou authored and adorilson committed Mar 11, 2021
1 parent c208106 commit 12ed704
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Include/methodobject.h
Expand Up @@ -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 *);

Expand Down
@@ -0,0 +1,2 @@
The :c:func:`PyCFunction_New` function is now exported in the ABI when
compiled with ``-fvisibility=hidden``.

0 comments on commit 12ed704

Please sign in to comment.