Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/5647.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix `PyMemberDescrObject.d_member` type in `pyo3-ffi` to use `PyMemberDef` for Python 3.11+ (was incorrectly `PyGetSetDef`).
6 changes: 6 additions & 0 deletions pyo3-ffi/src/cpython/descrobject.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use crate::{PyGetSetDef, PyMethodDef, PyObject, PyTypeObject};
use std::ffi::{c_char, c_int, c_void};

#[cfg(Py_3_11)]
use crate::PyMemberDef;

pub type wrapperfunc = Option<
unsafe extern "C" fn(
slf: *mut PyObject,
Expand Down Expand Up @@ -53,7 +56,10 @@ pub struct PyMethodDescrObject {
#[repr(C)]
pub struct PyMemberDescrObject {
pub d_common: PyDescrObject,
#[cfg(not(Py_3_11))]
pub d_member: *mut PyGetSetDef,
#[cfg(Py_3_11)]
pub d_member: *mut PyMemberDef,
}

#[repr(C)]
Expand Down
Loading