Skip to content

Commit 316fc01

Browse files
committed
PyPy
On PyPy, don't define PyVectorcall_NARGS() and PyObject_Vectorcall() when targeting the limited C API. PyPy always define these functions, even if Py_LIMITED_API macro is defined.
1 parent 8298b35 commit 316fc01

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎pythoncapi_compat.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,8 @@ _Py_COMP_DIAG_POP
687687

688688
// bpo-36974 added PyVectorcall_NARGS() to Python 3.8b1
689689
#if (PY_VERSION_HEX < _Py_PACK_VERSION(3, 8) \
690-
|| (defined(Py_LIMITED_API) && PY_VERSION_HEX < _Py_PACK_VERSION(3, 12)))
690+
|| (defined(Py_LIMITED_API) && PY_VERSION_HEX < _Py_PACK_VERSION(3, 12) \
691+
&& !defined(PYPY_VERSION)))
691692
static inline Py_ssize_t PyVectorcall_NARGS(size_t n)
692693
{
693694
return n & ~PY_VECTORCALL_ARGUMENTS_OFFSET;
@@ -697,7 +698,8 @@ static inline Py_ssize_t PyVectorcall_NARGS(size_t n)
697698

698699
// gh-105922 added PyObject_Vectorcall() to Python 3.9
699700
#if (PY_VERSION_HEX < _Py_PACK_VERSION(3, 9) \
700-
|| (defined(Py_LIMITED_API) && Py_LIMITED_API+0 < _Py_PACK_VERSION(3, 12)))
701+
|| (defined(Py_LIMITED_API) && Py_LIMITED_API+0 < _Py_PACK_VERSION(3, 12) \
702+
&& !defined(PYPY_VERSION)))
701703
static inline PyObject*
702704
PyObject_Vectorcall(PyObject *callable, PyObject *const *args,
703705
size_t nargsf, PyObject *kwnames)

0 commit comments

Comments
 (0)