Skip to content

Commit cf29081

Browse files
committed
fix all deprecations
1 parent f67af12 commit cf29081

File tree

16 files changed

+173
-191
lines changed

16 files changed

+173
-191
lines changed

examples/linalg/Cargo.lock

Lines changed: 14 additions & 64 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/linalg/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "rust_linalg"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = { version = "0.22.0", features = ["extension-module"] }
12+
pyo3 = { version = "0.23.0-dev", features = ["extension-module"] }
1313
numpy = { path = "../.." }
1414
ndarray-linalg = { version = "0.14.1", features = ["openblas-system"] }
1515

examples/parallel/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "rust_parallel"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = { version = "0.22.0", features = ["extension-module", "multiple-pymethods"] }
12+
pyo3 = { version = "0.23.0-dev", features = ["extension-module", "multiple-pymethods"] }
1313
numpy = { path = "../.." }
1414
ndarray = { version = "0.16", features = ["rayon", "blas"] }
1515
blas-src = { version = "0.8", features = ["openblas"] }

examples/simple/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "rust_ext"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = { version = "0.22.0", features = ["extension-module", "abi3-py37"] }
12+
pyo3 = { version = "0.23.0-dev", features = ["extension-module", "abi3-py37"] }
1313
numpy = { path = "../.." }
1414

1515
[workspace]

src/array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub type PyArrayDyn<T> = PyArray<T, IxDyn>;
118118

119119
/// Returns a handle to NumPy's multiarray module.
120120
pub fn get_array_module<'py>(py: Python<'py>) -> PyResult<Bound<'_, PyModule>> {
121-
PyModule::import_bound(py, npyffi::array::mod_name(py)?)
121+
PyModule::import(py, npyffi::array::mod_name(py)?)
122122
}
123123

124124
impl<T, D> DerefToPyAny for PyArray<T, D> {}
@@ -1674,7 +1674,7 @@ mod tests {
16741674
fn test_hasobject_flag() {
16751675
Python::with_gil(|py| {
16761676
let array: Bound<'_, PyArray<PyObject, _>> =
1677-
PyArray1::from_slice_bound(py, &[PyList::empty_bound(py).into()]);
1677+
PyArray1::from_slice_bound(py, &[PyList::empty(py).into()]);
16781678

16791679
py_run!(py, array, "assert array.dtype.hasobject");
16801680
});

src/array_like.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ where
169169
.bind(py);
170170

171171
let kwargs = if C::VAL {
172-
let kwargs = PyDict::new_bound(py);
172+
let kwargs = PyDict::new(py);
173173
kwargs.set_item(intern!(py, "dtype"), T::get_dtype_bound(py))?;
174174
Some(kwargs)
175175
} else {

src/borrow/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ mod tests {
654654
use pyo3::{types::IntoPyDict, Python};
655655

656656
use crate::array::PyArray1;
657+
use pyo3::ffi::c_str;
657658

658659
#[test]
659660
fn test_debug_formatting() {
@@ -697,9 +698,9 @@ mod tests {
697698
let array = PyArray::<f64, _>::zeros_bound(py, 10, false);
698699

699700
// The view will make the internal reference check of `PyArray_Resize` fail.
700-
let locals = [("array", &array)].into_py_dict_bound(py);
701+
let locals = [("array", &array)].into_py_dict(py).unwrap();
701702
let _view = py
702-
.eval_bound("array[:]", None, Some(&locals))
703+
.eval(c_str!("array[:]"), None, Some(&locals))
703704
.unwrap()
704705
.downcast_into::<PyArray1<f64>>()
705706
.unwrap();

0 commit comments

Comments
 (0)