Remove specialization from FromPyObject blanket impls

This commit is contained in:
David Hewitt 2020-01-07 09:01:35 +00:00
parent 7e591e310c
commit bf507da154
2 changed files with 6 additions and 2 deletions

View file

@ -7,6 +7,10 @@ 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.
## [0.8.5]
* Support for `#[name = "foo"]` attribute for `#[pyfunction]` and in `#[pymethods]`. [#692](https://github.com/PyO3/pyo3/pull/692)

View file

@ -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)?)
}
}