pypy: re-enable PyFunction on 3.8+

This commit is contained in:
David Hewitt 2022-12-27 13:59:23 +00:00
parent af2ad45c73
commit 24032fe110
3 changed files with 5 additions and 4 deletions

View File

@ -0,0 +1 @@
Re-enable `PyFunction` on when building for abi3 or PyPy.

View File

@ -53,12 +53,12 @@ pub struct PyFunctionObject {
#[cfg_attr(windows, link(name = "pythonXY"))] #[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" { extern "C" {
#[cfg(not(PyPy))] // broken, see https://foss.heptapod.net/pypy/pypy/-/issues/3776 #[cfg(not(all(PyPy, not(Py_3_8))))]
#[cfg_attr(PyPy, link_name = "PyPyFunction_Type")] #[cfg_attr(PyPy, link_name = "PyPyFunction_Type")]
pub static mut PyFunction_Type: crate::PyTypeObject; pub static mut PyFunction_Type: crate::PyTypeObject;
} }
#[cfg(not(PyPy))] #[cfg(not(all(PyPy, not(Py_3_8))))]
#[inline] #[inline]
pub unsafe fn PyFunction_Check(op: *mut PyObject) -> c_int { pub unsafe fn PyFunction_Check(op: *mut PyObject) -> c_int {
(crate::Py_TYPE(op) == addr_of_mut_shim!(PyFunction_Type)) as c_int (crate::Py_TYPE(op) == addr_of_mut_shim!(PyFunction_Type)) as c_int

View File

@ -179,8 +179,8 @@ impl PyCFunction {
/// Represents a Python function object. /// Represents a Python function object.
#[repr(transparent)] #[repr(transparent)]
#[cfg(not(any(PyPy, Py_LIMITED_API)))] #[cfg(all(not(Py_LIMITED_API), not(all(PyPy, not(Py_3_8)))))]
pub struct PyFunction(PyAny); pub struct PyFunction(PyAny);
#[cfg(not(any(PyPy, Py_LIMITED_API)))] #[cfg(all(not(Py_LIMITED_API), not(all(PyPy, not(Py_3_8)))))]
pyobject_native_type_core!(PyFunction, ffi::PyFunction_Type, #checkfunction=ffi::PyFunction_Check); pyobject_native_type_core!(PyFunction, ffi::PyFunction_Type, #checkfunction=ffi::PyFunction_Check);