Skip to content

Commit 29f1b36

Browse files
committed
Finish migration of error.rs
This commit finishes the migration of error.rs to use the new exception API in 0.12.0. Most of the work was done on this, just a few little pieces that needed to be updated to conform to the new api.
1 parent 11d29cc commit 29f1b36

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Defines error types.
22
use crate::types::DataType;
3-
use pyo3::{exceptions as exc, PyErr, PyErrArguments, PyErrValue, PyObject, Python, ToPyObject};
3+
use pyo3::{exceptions as exc, PyErr, PyErrArguments, PyObject, Python, ToPyObject};
44
use std::fmt;
55

66
/// Represents a dimension and dtype of numpy array.
@@ -63,14 +63,14 @@ macro_rules! impl_pyerr {
6363
impl std::error::Error for $err_type {}
6464

6565
impl PyErrArguments for $err_type {
66-
fn arguments(&self, py: Python) -> PyObject {
66+
fn arguments(self, py: Python) -> PyObject {
6767
format!("{}", self).to_object(py)
6868
}
6969
}
7070

7171
impl std::convert::From<$err_type> for PyErr {
7272
fn from(err: $err_type) -> PyErr {
73-
PyErr::from_value::<exc::PyTypeError>(PyErrValue::from_err_args(err))
73+
exc::PyTypeError::new_err(err)
7474
}
7575
}
7676
};

0 commit comments

Comments
 (0)