You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When implementing __iadd__, I assumed that I'd need to return a reference to self since that's generally the behavior expected in python. Following that logic, I wrote it with the signature:
This lead to a compiler error message about PyRefMut not implementing the correct conversion trait, which lead me down a bit of a rabbit hole until I found the correct section in the readme.
Ideally a dunder method with an incorrect signature could be detected, and the error message note the expected signature or just point users to the relevant section of the readme.
Steps to Reproduce
Define a pyclass with fn __iadd__<'a>(self_: PyRefMut<'a, Self>, other: &Self) -> PyRefMut<'a, Self>{...} in the impl block, observe the error message
Backtrace
No response
Your operating system and version
Windows 11
Your Python version (python --version)
Python 3.12.4
Your Rust version (rustc --version)
rustc 1.80.1 (3f5fd8dd4 2024-08-06)
Your PyO3 version
0.22.1
How did you install python? Did you use a virtualenv?
Basic installer for python, UV 0.3 used for virtualenv
Additional Info
No response
The text was updated successfully, but these errors were encountered:
Bug Description
When implementing
__iadd__
, I assumed that I'd need to return a reference to self since that's generally the behavior expected in python. Following that logic, I wrote it with the signature:fn __iadd__<'a>(self_: PyRefMut<'a, Self>, other: &Self) -> PyRefMut<'a, Self>
.This lead to a compiler error message about PyRefMut not implementing the correct conversion trait, which lead me down a bit of a rabbit hole until I found the correct section in the readme.
Ideally a dunder method with an incorrect signature could be detected, and the error message note the expected signature or just point users to the relevant section of the readme.
Steps to Reproduce
Define a pyclass with
fn __iadd__<'a>(self_: PyRefMut<'a, Self>, other: &Self) -> PyRefMut<'a, Self>{...}
in the impl block, observe the error messageBacktrace
No response
Your operating system and version
Windows 11
Your Python version (
python --version
)Python 3.12.4
Your Rust version (
rustc --version
)rustc 1.80.1 (3f5fd8dd4 2024-08-06)
Your PyO3 version
0.22.1
How did you install python? Did you use a virtualenv?
Basic installer for python, UV 0.3 used for virtualenv
Additional Info
No response
The text was updated successfully, but these errors were encountered: