diff --git a/CHANGELOG.md b/CHANGELOG.md index f7e8315c68b..bd8c315ba0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## Unreleased +### Changed + +* The blanket implementations for `FromPyObject` for `&T` and `&mut T` are no longer specializable. Implement `PyTryFrom` for your type to control the behavior of `FromPyObject::extract()` for your types. +* The implementation for `IntoPy for T` where `U: FromPy` is no longer specializable. Control the behavior of this via the implementation of `FromPy`. + ## [0.8.5] * Support for `#[name = "foo"]` attribute for `#[pyfunction]` and in `#[pymethods]`. [#692](https://github.com/PyO3/pyo3/pull/692) diff --git a/src/conversion.rs b/src/conversion.rs index 38f436de496..45c3a389331 100644 --- a/src/conversion.rs +++ b/src/conversion.rs @@ -146,7 +146,7 @@ impl IntoPy for T where U: FromPy, { - default fn into_py(self, py: Python) -> U { + fn into_py(self, py: Python) -> U { U::from_py(self, py) } } @@ -250,7 +250,7 @@ where T: PyTryFrom<'a>, { #[inline] - default fn extract(ob: &'a PyAny) -> PyResult<&'a T> { + fn extract(ob: &'a PyAny) -> PyResult<&'a T> { Ok(T::try_from(ob)?) } } @@ -261,7 +261,7 @@ where T: PyTryFrom<'a>, { #[inline] - default fn extract(ob: &'a PyAny) -> PyResult<&'a mut T> { + fn extract(ob: &'a PyAny) -> PyResult<&'a mut T> { Ok(T::try_from_mut(ob)?) } }