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
Is there a way to disable the behavior introduced in #3203? I had (knowingly) implemented the __richcomp__ function (as shown below) and now the new method in 0.20 does not seem to implement it in the same way.
def test_duration_eq():
""" Checks that Duration comparisons work"""
assert Unit.Second * 0.0 == Duration("0 ns")
> assert Unit.Second * 1.0 >= Duration("0 ns")
E TypeError: '>=' not supported between instances of 'builtins.Duration' and 'builtins.Duration'
tests/python/test_epoch.py:54: TypeError
=========================== short test summary info ============================
FAILED tests/python/test_epoch.py::test_duration_eq - TypeError: '>=' not supported between instances of 'builtins.Duration' and 'builtins.Duration'
========================= 1 failed, 3 passed in 0.12s ==========================
Your operating system and version
Windows and macOS
Your Python version (python --version)
3.11
Your Rust version (rustc --version)
1.74
Your PyO3 version
0.20.0
How did you install python? Did you use a virtualenv?
Using the maturin action on Github
Additional Info
No response
The text was updated successfully, but these errors were encountered:
@ChristopherRabotin in your linked PR you delete __richcmp__ and so all that remains is __eq__. I don't see implementations of ordering operators.
If you want ordering you should implement at least __lt__ and __le__. Because your types are symmetric you don't strictly need __gt__ and __ge__, the interpreter will fallback on __le__, and __lt__ by reversing the operands. For best performance you should implement all four of __lt__, __le__, __gt__ and __ge__.
Bug Description
Is there a way to disable the behavior introduced in #3203? I had (knowingly) implemented the
__richcomp__
function (as shown below) and now the new method in0.20
does not seem to implement it in the same way.Custom code for 0.19
Proof:
Automatic code in 0.20
https://github.com/nyx-space/hifitime/actions/runs/6898765377/job/18769311402?pr=259
Steps to Reproduce
0.20.0
from0.19.0
__richcomp__
methodBacktrace
Your operating system and version
Windows and macOS
Your Python version (
python --version
)3.11
Your Rust version (
rustc --version
)1.74
Your PyO3 version
0.20.0
How did you install python? Did you use a virtualenv?
Using the maturin action on Github
Additional Info
No response
The text was updated successfully, but these errors were encountered: