Skip to content

Commit

Permalink
Silence non_local_definition warnings until they fixed upstream in Py…
Browse files Browse the repository at this point in the history
…O3's macros
  • Loading branch information
adamreichold committed Apr 14, 2024
1 parent 0832b28 commit 75555c5
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions examples/linalg/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(non_local_definitions)]

use ndarray_linalg::solve::Inverse;
use numpy::{IntoPyArray, PyArray2, PyReadonlyArray2};
use pyo3::{exceptions::PyRuntimeError, pymodule, types::PyModule, Bound, PyResult, Python};
Expand Down
2 changes: 2 additions & 0 deletions examples/parallel/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(non_local_definitions)]

// We need to link `blas_src` directly, c.f. https://github.com/rust-ndarray/ndarray#how-to-enable-blas-integration
extern crate blas_src;

Expand Down
2 changes: 2 additions & 0 deletions examples/simple/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(non_local_definitions)]

use std::ops::Add;

use numpy::ndarray::{Array1, ArrayD, ArrayView1, ArrayViewD, ArrayViewMutD, Zip};
Expand Down
1 change: 1 addition & 0 deletions tests/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ fn dtype_via_python_attribute() {
}

#[test]
#[allow(non_local_definitions)]
fn borrow_from_array_works() {
#[pyclass]
struct Owner {
Expand Down
1 change: 1 addition & 0 deletions tests/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ fn exclusive_borrow_requires_writeable() {

#[test]
#[should_panic(expected = "AlreadyBorrowed")]
#[allow(non_local_definitions)]
fn borrows_span_frames() {
#[pyclass]
struct Borrower;
Expand Down
4 changes: 2 additions & 2 deletions tests/to_py.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ fn from_small_array() {
($($t:ty)+) => {
$({
Python::with_gil(|py| {
let array: [$t; 2] = [<$t>::min_value(), <$t>::max_value()];
let array: [$t; 2] = [<$t>::MIN, <$t>::MAX];
let pyarray = array.to_pyarray_bound(py);

assert_eq!(
pyarray.readonly().as_slice().unwrap(),
&[<$t>::min_value(), <$t>::max_value()]
&[<$t>::MIN, <$t>::MAX]
);
});
})+
Expand Down

0 comments on commit 75555c5

Please sign in to comment.