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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changelog

- Unreleased
- Fix PyArray_DTypeMeta definition when Py_LIMITED_API is disabled (#532)

- v0.28.0
- Fix mismatched behavior between `PyArrayLike1` and `PyArrayLike2` when used with floats ([#520](https://github.com/PyO3/rust-numpy/pull/520))
- Add ownership-moving conversions into `PyReadonlyArray` and `PyReadwriteArray` ([#524](https://github.com/PyO3/rust-numpy/pull/524))
Expand Down
14 changes: 14 additions & 0 deletions src/npyffi/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,20 @@ pub struct PyArray_DatetimeDTypeMetaData {
// https://github.com/rust-lang/rust/issues/43467
pub type npy_packed_static_string = c_void;
pub type npy_string_allocator = c_void;

#[cfg(not(Py_LIMITED_API))]
#[repr(C)]
pub struct PyArray_DTypeMeta {
pub superclass: PyHeapTypeObject,
pub singleton: *mut PyArray_Descr,
pub type_num: c_int,
pub scalar_type: *mut PyTypeObject,
Comment on lines 557 to 559
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the type_num field is missing here, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much! I completely missed that field.

pub flags: npy_uint64,
pub dt_slots: *mut c_void,
pub reserved: [*mut c_void; 3],
}

#[cfg(Py_LIMITED_API)]
pub type PyArray_DTypeMeta = PyTypeObject;

#[repr(C)]
Expand Down
Loading