]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-143006: Fix and optimize mixed comparison of float and int (GH-143084)...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 9 Jan 2026 17:32:23 +0000 (18:32 +0100)
committerGitHub <noreply@github.com>
Fri, 9 Jan 2026 17:32:23 +0000 (17:32 +0000)
commitebe5e216c894faf164130532a9b549bab480df33
tree7f813bba9a472574efff3473e8b2d17e65ad3871
parent18f9af2331ac32a24b33e3f97c67b3caa9e911f1
[3.14] gh-143006: Fix and optimize mixed comparison of float and int (GH-143084) (GH-143623)

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)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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