Skip to content

Commit e5ed4a9

Browse files
authored
Fix PyArray_DTypeMeta definition when Py_LIMITED_API is disabled (#532)
1 parent 7a5844b commit e5ed4a9

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Changelog
2+
3+
- Unreleased
4+
- Fix PyArray_DTypeMeta definition when Py_LIMITED_API is disabled (#532)
5+
26
- v0.28.0
37
- Fix mismatched behavior between `PyArrayLike1` and `PyArrayLike2` when used with floats ([#520](https://github.com/PyO3/rust-numpy/pull/520))
48
- Add ownership-moving conversions into `PyReadonlyArray` and `PyReadwriteArray` ([#524](https://github.com/PyO3/rust-numpy/pull/524))

src/npyffi/objects.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,20 @@ pub struct PyArray_DatetimeDTypeMetaData {
549549
// https://github.com/rust-lang/rust/issues/43467
550550
pub type npy_packed_static_string = c_void;
551551
pub type npy_string_allocator = c_void;
552+
553+
#[cfg(not(Py_LIMITED_API))]
554+
#[repr(C)]
555+
pub struct PyArray_DTypeMeta {
556+
pub superclass: PyHeapTypeObject,
557+
pub singleton: *mut PyArray_Descr,
558+
pub type_num: c_int,
559+
pub scalar_type: *mut PyTypeObject,
560+
pub flags: npy_uint64,
561+
pub dt_slots: *mut c_void,
562+
pub reserved: [*mut c_void; 3],
563+
}
564+
565+
#[cfg(Py_LIMITED_API)]
552566
pub type PyArray_DTypeMeta = PyTypeObject;
553567

554568
#[repr(C)]

0 commit comments

Comments
 (0)