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

Remove specialization from some blanket impls #713

Merged
merged 2 commits into from
Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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