Skip to content

fix: upgrade to rust-numpy 0.29, switch to cast_exact - #5

Merged
asjad2401 merged 2 commits into
masterfrom
fix/rust-numpy-0.29-cast-exact
Aug 1, 2026
Merged

fix: upgrade to rust-numpy 0.29, switch to cast_exact#5
asjad2401 merged 2 commits into
masterfrom
fix/rust-numpy-0.29-cast-exact

Conversation

@asjad2401

Copy link
Copy Markdown
Owner

Summary

  • Bumps pyo3 0.28.3 → 0.29.0 and numpy 0.28.0 → 0.29.0
  • Switches all 6 dtype-dispatch call sites from cast to cast_exact, now that PyO3/rust-numpy#550 fixed is_exact_type_of (shipped in 0.29.0)
  • cast_exact additionally rejects NumPy subclasses (e.g. np.matrix) via PyArray_CheckExact, which non-exact cast did not

Test plan

  • cargo build --release — clean
  • maturin develop --release && pytest -q — 38/38 pass
  • Manually verified np.matrix input is now rejected with TypeError; plain ndarrays unaffected

Closes out the cast/downcast workaround from Session 4 now that
PyO3/rust-numpy#550 fixed is_exact_type_of. cast_exact also rejects
numpy subclasses (e.g. np.matrix), which non-exact cast did not.
@asjad2401
asjad2401 merged commit b7b1313 into master Aug 1, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant