Fix a span site of `_slf` for custom receivers.
This commit is contained in:
parent
a3c4fd2fa0
commit
24343f2caa
|
@ -0,0 +1 @@
|
|||
Fix a compile error when `#[pymethods]` items come from somewhere else (for example, as a macro argument) and a custom receiver like `Py<Self>` is used.
|
|
@ -189,10 +189,11 @@ impl SelfType {
|
|||
}
|
||||
}
|
||||
SelfType::TryFromPyCell(span) => {
|
||||
let _slf = quote! { _slf };
|
||||
quote_spanned! { *span =>
|
||||
let _cell = #cell;
|
||||
#[allow(clippy::useless_conversion)] // In case _slf is PyCell<Self>
|
||||
let _slf = ::std::convert::TryFrom::try_from(_cell)?;
|
||||
let #_slf = ::std::convert::TryFrom::try_from(_cell)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1470,6 +1470,33 @@ issue_1506!(
|
|||
) {
|
||||
}
|
||||
|
||||
fn issue_1506_mut(
|
||||
&mut self,
|
||||
_py: Python<'_>,
|
||||
_arg: &PyAny,
|
||||
_args: &PyTuple,
|
||||
_kwargs: Option<&PyDict>,
|
||||
) {
|
||||
}
|
||||
|
||||
fn issue_1506_custom_receiver(
|
||||
_slf: Py<Self>,
|
||||
_py: Python<'_>,
|
||||
_arg: &PyAny,
|
||||
_args: &PyTuple,
|
||||
_kwargs: Option<&PyDict>,
|
||||
) {
|
||||
}
|
||||
|
||||
fn issue_1506_custom_receiver_explicit(
|
||||
_slf: Py<Issue1506>,
|
||||
_py: Python<'_>,
|
||||
_arg: &PyAny,
|
||||
_args: &PyTuple,
|
||||
_kwargs: Option<&PyDict>,
|
||||
) {
|
||||
}
|
||||
|
||||
#[new]
|
||||
fn issue_1506_new(
|
||||
_py: Python<'_>,
|
||||
|
|
Loading…
Reference in New Issue