mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
complex.__eq__ and __ne__ converted an int operand to f64 before comparing, so a complex whose real part is the float nearest to a large int compared equal to that int even when the values differ: complex(2**53 + 1) == 2**53 + 1 returned True, while float(2**53 + 1) == 2**53 + 1 returns False and the two objects hash differently. When the imaginary part is zero, compare the real part against the exact integer with float_ops::eq_int, the helper float's own comparison uses. This matches CPython, which hands an int operand to float's rich comparison. test_complex.test_richcompare_boundaries now passes, so drop its expectedFailure marker. Assisted-by: Claude Code:claude-opus-5-5