Skip to content

Commit 28bbe9a

Browse files
committed
use PyDowncastError constructor and add Debug for test/array.rs
1 parent 507087c commit 28bbe9a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/array.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ use crate::types::Element;
7575
/// array![[8., 15.], [12., 23.]]
7676
/// );
7777
/// ```
78+
#[derive(Debug)]
7879
pub struct PyArray<T, D>(PyAny, PhantomData<T>, PhantomData<D>);
7980

8081
/// One-dimensional array.
@@ -131,7 +132,7 @@ impl<'a, T: Element, D: Dimension> FromPyObject<'a> for &'a PyArray<T, D> {
131132
fn extract(ob: &'a PyAny) -> PyResult<Self> {
132133
let array = unsafe {
133134
if npyffi::PyArray_Check(ob.as_ptr()) == 0 {
134-
return Err(PyDowncastError.into());
135+
return Err(PyDowncastError::new(ob, "Array").into());
135136
}
136137
&*(ob as *const PyAny as *const PyArray<T, D>)
137138
};

0 commit comments

Comments
 (0)