diff --git a/src/ffi/cpython/dictobject.rs b/src/ffi/cpython/dictobject.rs index 16a22872..5f1a7a0a 100644 --- a/src/ffi/cpython/dictobject.rs +++ b/src/ffi/cpython/dictobject.rs @@ -3,6 +3,19 @@ use crate::ffi::object::*; use crate::ffi::pyport::Py_ssize_t; use std::os::raw::c_int; +opaque_struct!(PyDictKeysObject); + +#[repr(C)] +#[derive(Debug)] +// Not moved because dict.rs uses PyDictObject extensively. +pub struct PyDictObject { + pub ob_base: PyObject, + pub ma_used: Py_ssize_t, + pub ma_version_tag: u64, + pub ma_keys: *mut PyDictKeysObject, + pub ma_values: *mut *mut PyObject, +} + extern "C" { // skipped _PyDict_GetItem_KnownHash // skipped _PyDict_GetItemIdWithError diff --git a/src/ffi/dictobject.rs b/src/ffi/dictobject.rs index 246fa0bc..843112d3 100644 --- a/src/ffi/dictobject.rs +++ b/src/ffi/dictobject.rs @@ -107,17 +107,6 @@ extern "C" { pub static mut PyDictRevIterItem_Type: PyTypeObject; } -#[repr(C)] -#[derive(Debug)] -// TODO: move to cpython/dictobject.rs -// Not moved because dict.rs uses PyDictObject extensively. -pub struct PyDictObject { - pub ob_base: PyObject, - pub ma_used: Py_ssize_t, - pub ma_version_tag: u64, - pub ma_keys: *mut PyDictKeysObject, - pub ma_values: *mut *mut PyObject, -} - -// TODO: move to cpython/dictobject.rs -opaque_struct!(PyDictKeysObject); +#[cfg(Py_LIMITED_API)] +// TODO: remove (see https://github.com/PyO3/pyo3/pull/1341#issuecomment-751515985) +opaque_struct!(PyDictObject); diff --git a/src/ffi/floatobject.rs b/src/ffi/floatobject.rs index d454edcc..d33feb9a 100644 --- a/src/ffi/floatobject.rs +++ b/src/ffi/floatobject.rs @@ -1,8 +1,11 @@ use crate::ffi::object::*; use std::os::raw::{c_double, c_int}; -// TODO: mark non-limited -// currently used by types/floatob.rs +#[cfg(Py_LIMITED_API)] +// TODO: remove (see https://github.com/PyO3/pyo3/pull/1341#issuecomment-751515985) +opaque_struct!(PyFloatObject); + +#[cfg(not(Py_LIMITED_API))] #[repr(C)] pub struct PyFloatObject { pub ob_base: PyObject,