diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c3bffd2..8bdfb825 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fix inability to add `#[text_signature]` to some `#[pyproto]` methods. [#1483](https://github.com/PyO3/pyo3/pull/1483) - Fix use of Python argument for #[pymethods] inside macro expansions. [#1505](https://github.com/PyO3/pyo3/pull/1505) - Always use cross-compiling configuration if any of the environment variables are set. [#1514](https://github.com/PyO3/pyo3/pull/1514) +- Support `EnvironmentError`, `IOError`, and `WindowsError` on PyPy. [#1533](https://github.com/PyO3/pyo3/pull/1533) ## [0.13.2] - 2021-02-12 ### Packaging diff --git a/src/exceptions.rs b/src/exceptions.rs index b2efa8a7..8f957734 100644 --- a/src/exceptions.rs +++ b/src/exceptions.rs @@ -274,11 +274,9 @@ impl_native_exception!(PyPermissionError, PyExc_PermissionError); impl_native_exception!(PyProcessLookupError, PyExc_ProcessLookupError); impl_native_exception!(PyTimeoutError, PyExc_TimeoutError); -#[cfg(not(all(windows, PyPy)))] impl_native_exception!(PyEnvironmentError, PyExc_EnvironmentError); -#[cfg(not(all(windows, PyPy)))] impl_native_exception!(PyIOError, PyExc_IOError); -#[cfg(all(windows, not(PyPy)))] +#[cfg(windows)] impl_native_exception!(PyWindowsError, PyExc_WindowsError); impl PyUnicodeDecodeError { diff --git a/src/ffi/pyerrors.rs b/src/ffi/pyerrors.rs index f5b99fe1..f4e66c79 100644 --- a/src/ffi/pyerrors.rs +++ b/src/ffi/pyerrors.rs @@ -283,11 +283,12 @@ extern "C" { #[cfg_attr(PyPy, link_name = "PyPyExc_TimeoutError")] pub static mut PyExc_TimeoutError: *mut PyObject; - #[cfg(not(all(windows, PyPy)))] + #[cfg_attr(PyPy, link_name = "PyPyExc_OSError")] pub static mut PyExc_EnvironmentError: *mut PyObject; - #[cfg(not(all(windows, PyPy)))] + #[cfg_attr(PyPy, link_name = "PyPyExc_OSError")] pub static mut PyExc_IOError: *mut PyObject; - #[cfg(all(windows, not(PyPy)))] + #[cfg(windows)] + #[cfg_attr(PyPy, link_name = "PyPyExc_OSError")] pub static mut PyExc_WindowsError: *mut PyObject; pub static mut PyExc_RecursionErrorInst: *mut PyObject;