Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement eyre feature #1893

Merged
merged 11 commits into from
Oct 13, 2021
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Packaging

- Support Python 3.10. [#1889](https://github.com/PyO3/pyo3/pull/1889)
- Added optional `eyre` feature to convert `eyre::Report` into `PyErr`. [#1893](https://github.com/PyO3/pyo3/pull/1893)

### Added

Expand All @@ -22,10 +23,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `PyMapping` type to represent the Python mapping protocol. [#1844](https://github.com/PyO3/pyo3/pull/1844)
- Add commonly-used sequence methods to `PyList` and `PyTuple`. [#1849](https://github.com/PyO3/pyo3/pull/1849)
- Add `as_sequence` methods to `PyList` and `PyTuple`. [#1860](https://github.com/PyO3/pyo3/pull/1860)
- Add `eyre` feature to convert `eyre::report` into `PyErr`. [#1893](https://github.com/PyO3/pyo3/pull/1893)
- Add `eyre` feature to convert `eyre::Report` into `PyErr`. [#1893](https://github.com/PyO3/pyo3/pull/1893)
mejrs marked this conversation as resolved.
Show resolved Hide resolved
- Add `abi3-py310` feature. [#1889](https://github.com/PyO3/pyo3/pull/1889)


### Changed

- Change `PyErr::fetch` to return `Option<PyErr>`. [#1717](https://github.com/PyO3/pyo3/pull/1717)
Expand Down
13 changes: 3 additions & 10 deletions src/conversions/eyre.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,11 @@
//! use pyo3::wrap_pyfunction;
//! use std::path::PathBuf;
//!
//! // An example function that returns `eyre::Result<...>`.
//! fn rust_open(filename: PathBuf) -> eyre::Result<Vec<u8>> {
//! let data = std::fs::read(filename)?;
//! Ok(data)
//! }
//!
//! // A wrapper around a Rust function.
//! // The pyfunction macro performs the conversion to a PyErr
//! #[pyfunction]
//! fn py_open(filename: PathBuf) -> PyResult<Vec<u8>> {
//! // The `?` ("try") operator performs the conversion
//! // into a `PyErr` - if it is an error.
//! let data = rust_open(filename)?;
//! fn py_open(filename: PathBuf) -> eyre::Result<Vec<u8>> {
//! let data = std::fs::read(filename)?;
//! Ok(data)
//! }
//!
Expand Down