@@ -17,7 +17,7 @@ use std::{iter::ExactSizeIterator, marker::PhantomData};
1717use crate :: convert:: { ArrayExt , IntoPyArray , NpyIndex , ToNpyDims , ToPyArray } ;
1818use crate :: dtype:: { DataType , Element } ;
1919use crate :: error:: { FromVecError , NotContiguousError , ShapeError } ;
20- use crate :: owner :: Owner ;
20+ use crate :: slice_container :: PySliceContainer ;
2121
2222/// A safe, static-typed interface for
2323/// [NumPy ndarray](https://numpy.org/doc/stable/reference/arrays.ndarray.html).
@@ -447,7 +447,7 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
447447 dims : ID ,
448448 strides : * const npy_intp ,
449449 data_ptr : * const T ,
450- owner : * mut PyAny ,
450+ container : * mut PyAny ,
451451 ) -> & ' py Self
452452 where
453453 ID : IntoDimension < Dim = D > ,
@@ -467,36 +467,36 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
467467
468468 PY_ARRAY_API . PyArray_SetBaseObject (
469469 ptr as * mut npyffi:: PyArrayObject ,
470- owner as * mut ffi:: PyObject ,
470+ container as * mut ffi:: PyObject ,
471471 ) ;
472472
473473 Self :: from_owned_ptr ( py, ptr)
474474 }
475475
476- pub ( crate ) unsafe fn from_raw_parts < ' py , ID , O > (
476+ pub ( crate ) unsafe fn from_raw_parts < ' py , ID , C > (
477477 py : Python < ' py > ,
478478 dims : ID ,
479479 strides : * const npy_intp ,
480480 data_ptr : * const T ,
481- owner : O ,
481+ container : C ,
482482 ) -> & ' py Self
483483 where
484484 ID : IntoDimension < Dim = D > ,
485- Owner : From < O > ,
485+ PySliceContainer : From < C > ,
486486 {
487- let owner = pyo3:: PyClassInitializer :: from ( Owner :: from ( owner ) )
487+ let container = pyo3:: PyClassInitializer :: from ( PySliceContainer :: from ( container ) )
488488 . create_cell ( py)
489489 . expect ( "Object creation failed." ) ;
490490
491- Self :: new_with_data ( py, dims, strides, data_ptr, owner as * mut PyAny )
491+ Self :: new_with_data ( py, dims, strides, data_ptr, container as * mut PyAny )
492492 }
493493
494- /// Creates a NumPy array backed by `array` and ties its ownership to the Python object `owner `.
494+ /// Creates a NumPy array backed by `array` and ties its ownership to the Python object `container `.
495495 ///
496496 /// # Safety
497497 ///
498- /// `owner ` is set as a base object of the returned array which must not be dropped until `owner ` is dropped.
499- /// Furthermore, `array` must not be reallocated from the time this method is called and until `owner ` is dropped.
498+ /// `container ` is set as a base object of the returned array which must not be dropped until `container ` is dropped.
499+ /// Furthermore, `array` must not be reallocated from the time this method is called and until `container ` is dropped.
500500 ///
501501 /// # Example
502502 ///
@@ -521,21 +521,26 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
521521 /// }
522522 /// }
523523 /// ```
524- pub unsafe fn borrow_from_array < ' py , S > ( array : & ArrayBase < S , D > , owner : & ' py PyAny ) -> & ' py Self
524+ pub unsafe fn borrow_from_array < ' py , S > (
525+ array : & ArrayBase < S , D > ,
526+ container : & ' py PyAny ,
527+ ) -> & ' py Self
525528 where
526529 S : Data < Elem = T > ,
527530 {
528531 let ( strides, dims) = ( array. npy_strides ( ) , array. raw_dim ( ) ) ;
529532 let data_ptr = array. as_ptr ( ) ;
530533
531- mem:: forget ( owner. to_object ( owner. py ( ) ) ) ;
534+ let py = container. py ( ) ;
535+
536+ mem:: forget ( container. to_object ( py) ) ;
532537
533538 Self :: new_with_data (
534- owner . py ( ) ,
539+ py ,
535540 dims,
536541 strides. as_ptr ( ) ,
537542 data_ptr,
538- owner as * const PyAny as * mut PyAny ,
543+ container as * const PyAny as * mut PyAny ,
539544 )
540545 }
541546
0 commit comments