PyO3 / rust-numpy

PyO3-based Rust bindings of the NumPy C-API
BSD 2-Clause "Simplified" License
1.11k stars 106 forks source link

migrate `PyArray` contructors to `Bound` API (Part 1) #416

Closed Icxolu closed 6 months ago

Icxolu commented 6 months ago

Following #415

This migrates PyArray constructors to the Bound API. I created a commit for each constructor migration. To keep the diff reviewable I will split this over multiple PRs. This starts the migration with PyArray::{new, borrow_from_array, from_owned_array, zeros}.

(This also reexports PyArray0Methods, which we forgot in #415)

adamreichold commented 6 months ago

The commit message

deprecate PyArray::D>::borrow_from_array

seems to still contain a stray ::D> or GitHub's UI is somehow mangling this.

(As an aside, I really like this commit as I think it is a glimpse of how the bound API will play out simplifying memory-management-remembering-there-is-a-GIL-pool-behind-the-scenes gymnastics throughout the ecosystem.)