diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6dfe756d635..e10e1fc1491 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,16 @@ jobs: fail-fast: false # If one platform fails, allow the rest to keep testing. matrix: rust: [stable] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11-dev", "pypy-3.7", "pypy-3.8"] + python-version: [ + "3.7", + "3.8", + "3.9", + "3.10", + "3.11-dev", + "pypy-3.7", + "pypy-3.8", + "pypy-3.9-v7.3.8rc1" + ] platform: [ { diff --git a/pyo3-ffi/src/cpython/abstract_.rs b/pyo3-ffi/src/cpython/abstract_.rs index a7383c2fc0c..240e30f04c2 100644 --- a/pyo3-ffi/src/cpython/abstract_.rs +++ b/pyo3-ffi/src/cpython/abstract_.rs @@ -6,7 +6,7 @@ use crate::{ pyport::PY_SSIZE_T_MAX, vectorcallfunc, PyCallable_Check, PyThreadState, PyThreadState_GET, PyTuple_Check, PyType_HasFeature, Py_TPFLAGS_HAVE_VECTORCALL, }; -#[cfg(all(Py_3_8, not(PyPy)))] +#[cfg(Py_3_8)] use libc::size_t; extern "C" { @@ -98,17 +98,29 @@ pub unsafe fn PyObject_Vectorcall( } extern "C" { - #[cfg(all(Py_3_8, not(PyPy)))] - #[cfg_attr(not(Py_3_9), link_name = "_PyObject_VectorcallDict")] + #[cfg(all(PyPy, Py_3_8))] + #[cfg_attr(not(Py_3_9), link_name = "_PyPyObject_Vectorcall")] + pub fn PyObject_Vectorcall( + callable: *mut PyObject, + args: *const *mut PyObject, + nargsf: size_t, + kwnames: *mut PyObject, + ) -> *mut PyObject; + + #[cfg(all(Py_3_8))] + #[cfg_attr(all(not(PyPy), not(Py_3_9)), link_name = "_PyObject_VectorcallDict")] + #[cfg_attr(all(PyPy, not(Py_3_9)), link_name = "_PyPyObject_VectorcallDict")] + #[cfg_attr(all(PyPy, Py_3_9), link_name = "PyPyObject_VectorcallDict")] pub fn PyObject_VectorcallDict( callable: *mut PyObject, args: *const *mut PyObject, nargsf: size_t, - kwargs: *mut PyObject, + kwdict: *mut PyObject, ) -> *mut PyObject; - #[cfg(all(Py_3_8, not(PyPy)))] - #[cfg_attr(not(Py_3_9), link_name = "_PyVectorcall_Call")] + #[cfg(all(Py_3_8))] + #[cfg_attr(not(any(Py_3_9, PyPy)), link_name = "_PyVectorcall_Call")] + #[cfg_attr(PyPy, link_name = "PyPyVectorcall_Call")] pub fn PyVectorcall_Call( callable: *mut PyObject, tuple: *mut PyObject, @@ -149,6 +161,12 @@ pub unsafe fn _PyObject_CallNoArg(func: *mut PyObject) -> *mut PyObject { ) } +extern "C" { + #[cfg(PyPy)] + #[link_name = "_PyPyObject_CallNoArg"] + pub fn _PyObject_CallNoArg(func: *mut PyObject) -> *mut PyObject; +} + #[cfg(all(Py_3_8, not(PyPy)))] #[inline(always)] pub unsafe fn PyObject_CallOneArg(func: *mut PyObject, arg: *mut PyObject) -> *mut PyObject {