Skip to content

Commit cdb1ed9

Browse files
committed
Avoid deprecation warnings in example projects.
1 parent 775d6d0 commit cdb1ed9

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

examples/linalg/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use pyo3::prelude::{pymodule, PyErr, PyModule, PyResult, Python};
55

66
#[pymodule]
77
fn rust_linalg(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
8-
#[pyfn(m, "inv")]
8+
#[pyfn(m)]
99
fn inv<'py>(py: Python<'py>, x: PyReadonlyArray2<'py, f64>) -> PyResult<&'py PyArray2<f64>> {
1010
let x = x
1111
.as_array()

examples/simple-extension/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ fn rust_ext(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
2020
}
2121

2222
// wrapper of `axpy`
23-
#[pyfn(m, "axpy")]
23+
#[pyfn(m)]
24+
#[pyo3(name = "axpy")]
2425
fn axpy_py<'py>(
2526
py: Python<'py>,
2627
a: f64,
@@ -33,14 +34,16 @@ fn rust_ext(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
3334
}
3435

3536
// wrapper of `mult`
36-
#[pyfn(m, "mult")]
37+
#[pyfn(m)]
38+
#[pyo3(name = "mult")]
3739
fn mult_py(a: f64, x: &PyArrayDyn<f64>) {
3840
let x = unsafe { x.as_array_mut() };
3941
mult(a, x);
4042
}
4143

4244
// wrapper of `conj`
43-
#[pyfn(m, "conj")]
45+
#[pyfn(m)]
46+
#[pyo3(name = "conj")]
4447
fn conj_py<'py>(py: Python<'py>, x: PyReadonlyArrayDyn<'_, c64>) -> &'py PyArrayDyn<c64> {
4548
conj(x.as_array()).into_pyarray(py)
4649
}

0 commit comments

Comments
 (0)