Skip to content

fix: replace deprecated downcast with cast (PyO3 0.28 migration) - #3

Merged
asjad2401 merged 1 commit into
masterfrom
fix/replace-deprecated-downcast-with-cast
May 21, 2026
Merged

fix: replace deprecated downcast with cast (PyO3 0.28 migration)#3
asjad2401 merged 1 commit into
masterfrom
fix/replace-deprecated-downcast-with-cast

Conversation

@asjad2401

Copy link
Copy Markdown
Owner

What this does

Removes #![allow(deprecated)] and migrates all dtype-dispatch calls from
the deprecated downcast to the recommended cast API.

Background

Filed PyO3/rust-numpy#549 to ask about the migration path. A maintainer
confirmed that cast (non-exact) uses PyTypeInfo::is_type_of which calls
rust-numpy's extract internally — this performs the same dtype check as
the old downcast, making it a correct drop-in replacement.

Changes

  • Remove #![allow(deprecated)]
  • Replace 6× x.downcast::<PyArrayDyn<T>>()x.cast::<PyArrayDyn<T>>()

Verified

All 16 correctness checks pass. Dtype dispatch, error handling, and
benchmarks are identical to before.

@asjad2401
asjad2401 merged commit 4bd0646 into master May 21, 2026
17 checks passed
@asjad2401
asjad2401 deleted the fix/replace-deprecated-downcast-with-cast branch May 21, 2026 14:52
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