diff --git a/newsfragments/3339.added.md b/newsfragments/3339.added.md new file mode 100644 index 00000000000..88884bfd841 --- /dev/null +++ b/newsfragments/3339.added.md @@ -0,0 +1 @@ +Define `PyType_GetDict()` FFI for CPython 3.12 or later. diff --git a/pyo3-ffi/src/cpython/object.rs b/pyo3-ffi/src/cpython/object.rs index 76ab074f3d0..8209524fce7 100644 --- a/pyo3-ffi/src/cpython/object.rs +++ b/pyo3-ffi/src/cpython/object.rs @@ -349,6 +349,9 @@ pub unsafe fn PyHeapType_GET_MEMBERS( // skipped _PyType_GetModuleByDef extern "C" { + #[cfg(Py_3_12)] + pub fn PyType_GetDict(o: *mut PyTypeObject) -> *mut PyObject; + #[cfg_attr(PyPy, link_name = "PyPyObject_Print")] pub fn PyObject_Print(o: *mut PyObject, fp: *mut ::libc::FILE, flags: c_int) -> c_int;