diff --git a/CHANGELOG.md b/CHANGELOG.md index e02fd0d2..cd77bcdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix FFI definitions `PyDateTime_CAPI`. `PyDateTime_Date`, `PyASCIIObject`, `PyBaseExceptionObject`, `PyListObject`, and `PyTypeObject` on PyPy. [#2428](https://github.com/PyO3/pyo3/pull/2428) - Fix FFI definition `_inittab` field `initfunc` typo'd as `initfun`. [#2431](https://github.com/PyO3/pyo3/pull/2431) - Fix FFI definitions `_PyDateTime_BaseTime` and `_PyDateTime_BaseDateTime` incorrectly having `fold` member. [#2432](https://github.com/PyO3/pyo3/pull/2432) +- Fix FFI definitions `PyTypeObject`. `PyHeapTypeObject`, and `PyCFunctionObject` having incorrect members on PyPy 3.9. [#2428](https://github.com/PyO3/pyo3/pull/2428) ## [0.16.5] - 2022-05-15 diff --git a/pyo3-ffi/src/cpython/object.rs b/pyo3-ffi/src/cpython/object.rs index c81c703b..d8567129 100644 --- a/pyo3-ffi/src/cpython/object.rs +++ b/pyo3-ffi/src/cpython/object.rs @@ -214,15 +214,15 @@ pub type printfunc = #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct PyTypeObject { - #[cfg(PyPy)] + #[cfg(all(PyPy, not(Py_3_9)))] pub ob_refcnt: Py_ssize_t, - #[cfg(PyPy)] + #[cfg(all(PyPy, not(Py_3_9)))] pub ob_pypy_link: Py_ssize_t, - #[cfg(PyPy)] + #[cfg(all(PyPy, not(Py_3_9)))] pub ob_type: *mut PyTypeObject, - #[cfg(PyPy)] + #[cfg(all(PyPy, not(Py_3_9)))] pub ob_size: Py_ssize_t, - #[cfg(not(PyPy))] + #[cfg(not(all(PyPy, not(Py_3_9))))] pub ob_base: object::PyVarObject, pub tp_name: *const c_char, pub tp_basicsize: Py_ssize_t, @@ -276,7 +276,7 @@ pub struct PyTypeObject { pub tp_finalize: Option, #[cfg(Py_3_8)] pub tp_vectorcall: Option, - #[cfg(all(Py_3_8, not(Py_3_9)))] + #[cfg(any(all(PyPy, Py_3_8), all(not(PyPy), Py_3_8, not(Py_3_9))))] pub tp_print: Option, #[cfg(PyPy)] pub tp_pypy_flags: std::os::raw::c_long, @@ -304,6 +304,7 @@ pub struct PyHeapTypeObject { pub ht_name: *mut object::PyObject, pub ht_slots: *mut object::PyObject, pub ht_qualname: *mut object::PyObject, + #[cfg(not(PyPy))] pub ht_cached_keys: *mut c_void, #[cfg(Py_3_9)] pub ht_module: *mut object::PyObject, diff --git a/pyo3-ffi/src/cpython/pyerrors.rs b/pyo3-ffi/src/cpython/pyerrors.rs index 8464d4fa..dcf19dea 100644 --- a/pyo3-ffi/src/cpython/pyerrors.rs +++ b/pyo3-ffi/src/cpython/pyerrors.rs @@ -120,11 +120,17 @@ pub struct PyOSErrorObject { #[derive(Debug)] pub struct PyStopIterationObject { pub ob_base: PyObject, + #[cfg(not(PyPy))] pub dict: *mut PyObject, + #[cfg(not(PyPy))] pub args: *mut PyObject, + #[cfg(not(PyPy))] pub traceback: *mut PyObject, + #[cfg(not(PyPy))] pub context: *mut PyObject, + #[cfg(not(PyPy))] pub cause: *mut PyObject, + #[cfg(not(PyPy))] pub suppress_context: char, pub value: *mut PyObject, diff --git a/pyo3-ffi/src/methodobject.rs b/pyo3-ffi/src/methodobject.rs index c91857be..964c9a7c 100644 --- a/pyo3-ffi/src/methodobject.rs +++ b/pyo3-ffi/src/methodobject.rs @@ -10,7 +10,6 @@ pub struct PyCFunctionObject { pub m_ml: *mut PyMethodDef, pub m_self: *mut PyObject, pub m_module: *mut PyObject, - #[cfg(not(PyPy))] pub m_weakreflist: *mut PyObject, #[cfg(not(PyPy))] pub vectorcall: Option,