Skip to content

Commit

Permalink
pypy: re-enable PyFunction on 3.8+
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Dec 27, 2022
1 parent af2ad45 commit 24032fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions newsfragments/2838.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Re-enable `PyFunction` on when building for abi3 or PyPy.
4 changes: 2 additions & 2 deletions pyo3-ffi/src/cpython/funcobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ pub struct PyFunctionObject {

#[cfg_attr(windows, link(name = "pythonXY"))]
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")]
pub static mut PyFunction_Type: crate::PyTypeObject;
}

#[cfg(not(PyPy))]
#[cfg(not(all(PyPy, not(Py_3_8))))]
#[inline]
pub unsafe fn PyFunction_Check(op: *mut PyObject) -> c_int {
(crate::Py_TYPE(op) == addr_of_mut_shim!(PyFunction_Type)) as c_int
Expand Down
4 changes: 2 additions & 2 deletions src/types/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ impl PyCFunction {

/// Represents a Python function object.
#[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);

#[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);

0 comments on commit 24032fe

Please sign in to comment.