Skip to content

Commit a858c2e

Browse files
committed
Fix #4723: ambiguous associated item in #[pyclass]
This uses the fix described in rust-lang/rust#57644
1 parent 7fdbf5a commit a858c2e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pyo3-macros-backend/src/pyclass.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,10 +1072,13 @@ fn impl_complex_enum(
10721072
quote! {
10731073
impl<'py> #pyo3_path::conversion::IntoPyObject<'py> for #cls {
10741074
type Target = Self;
1075-
type Output = #pyo3_path::Bound<'py, Self::Target>;
1075+
type Output = #pyo3_path::Bound<'py, <Self as #pyo3_path::conversion::IntoPyObject>::Target>;
10761076
type Error = #pyo3_path::PyErr;
10771077

1078-
fn into_pyobject(self, py: #pyo3_path::Python<'py>) -> ::std::result::Result<Self::Output, Self::Error> {
1078+
fn into_pyobject(self, py: #pyo3_path::Python<'py>) -> ::std::result::Result<
1079+
<Self as #pyo3_path::conversion::IntoPyObject>::Output,
1080+
<Self as #pyo3_path::conversion::IntoPyObject>::Error,
1081+
> {
10791082
match self {
10801083
#(#match_arms)*
10811084
}
@@ -2161,10 +2164,13 @@ impl<'a> PyClassImplsBuilder<'a> {
21612164

21622165
impl<'py> #pyo3_path::conversion::IntoPyObject<'py> for #cls {
21632166
type Target = Self;
2164-
type Output = #pyo3_path::Bound<'py, Self::Target>;
2167+
type Output = #pyo3_path::Bound<'py, <Self as #pyo3_path::conversion::IntoPyObject>::Target>;
21652168
type Error = #pyo3_path::PyErr;
21662169

2167-
fn into_pyobject(self, py: #pyo3_path::Python<'py>) -> ::std::result::Result<Self::Output, Self::Error> {
2170+
fn into_pyobject(self, py: #pyo3_path::Python<'py>) -> ::std::result::Result<
2171+
<Self as #pyo3_path::conversion::IntoPyObject>::Output,
2172+
<Self as #pyo3_path::conversion::IntoPyObject>::Error,
2173+
> {
21682174
#pyo3_path::Bound::new(py, self)
21692175
}
21702176
}

0 commit comments

Comments
 (0)