Skip to content

Commit

Permalink
Merge pull request #713 from davidhewitt/remove-specializations
Browse files Browse the repository at this point in the history
Remove specialization from some blanket impls
  • Loading branch information
kngwyu committed Jan 7, 2020
2 parents 7e591e3 + 72e9abd commit 18440d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<U> for T` where `U: FromPy<T>` 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)
Expand Down
6 changes: 3 additions & 3 deletions src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl<T, U> IntoPy<U> for T
where
U: FromPy<T>,
{
default fn into_py(self, py: Python) -> U {
fn into_py(self, py: Python) -> U {
U::from_py(self, py)
}
}
Expand Down Expand Up @@ -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)?)
}
}
Expand All @@ -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)?)
}
}
Expand Down

0 comments on commit 18440d7

Please sign in to comment.