Skip to content

Commit bdf9d53

Browse files
authored
Merge pull request #296 from PyO3/fix-npy-aligned-struct
Since npy_char is c_char which can be u8 or i8, we cannot unconditionally use negation.
2 parents a556d79 + 996d4bc commit bdf9d53

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
- Unreleased
4+
- Fix build on platforms where `c_char` is `u8` like Linux/AArch64. ([#296](https://github.com/PyO3/rust-numpy/pull/296))
45

56
- v0.16.1
67
- Fix build when PyO3's `multiple-pymethods` feature is used. ([#288](https://github.com/PyO3/rust-numpy/pull/288))

src/npyffi/flags.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ pub const NPY_NEEDS_INIT: npy_char = 0x08;
7171
pub const NPY_NEEDS_PYAPI: npy_char = 0x10;
7272
pub const NPY_USE_GETITEM: npy_char = 0x20;
7373
pub const NPY_USE_SETITEM: npy_char = 0x40;
74-
pub const NPY_ALIGNED_STRUCT: npy_char = -128; // 0x80
74+
#[allow(overflowing_literals)]
75+
pub const NPY_ALIGNED_STRUCT: npy_char = 0x80;
7576
pub const NPY_FROM_FIELDS: npy_char =
7677
NPY_NEEDS_INIT | NPY_LIST_PICKLE | NPY_ITEM_REFCOUNT | NPY_NEEDS_PYAPI;
7778
pub const NPY_OBJECT_DTYPE_FLAGS: npy_char = NPY_LIST_PICKLE

0 commit comments

Comments
 (0)