]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-143006: Fix and optimize mixed comparison of float and int (GH-143084)...
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 9 Jan 2026 17:43:35 +0000 (19:43 +0200)
committerGitHub <noreply@github.com>
Fri, 9 Jan 2026 17:43:35 +0000 (17:43 +0000)
commit618a42410fe1b5f8c82c385ad34a566da904bf03
tree707362d60b94b19dc88c0e9b74c7ac54e5c4d670
parent57c56b0fb173e4b39ef4591d8745049ede129034
[3.13] gh-143006: Fix and optimize mixed comparison of float and int (GH-143084) (GH-143624)

When comparing negative non-integer float and int with the same number
of bits in the integer part, __neg__() in the int subclass returning
not an int caused an assertion error.

Now the integer is no longer negated. Also, reduced the number of
temporary created Python objects.
(cherry picked from commit 66bca383bd3b12d21e879d991d77b37a4c638f88)
Lib/test/test_float.py
Misc/NEWS.d/next/Core and Builtins/2025-12-22-22-37-53.gh-issue-143006.ZBQwbN.rst [new file with mode: 0644]
Objects/floatobject.c