]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-143006: Fix and optimize mixed comparison of float and int (GH-143084)
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 9 Jan 2026 17:06:45 +0000 (19:06 +0200)
committerGitHub <noreply@github.com>
Fri, 9 Jan 2026 17:06:45 +0000 (19:06 +0200)
commit66bca383bd3b12d21e879d991d77b37a4c638f88
tree61b8fe2e1d3c8cd4d8e9500975a262d5a7835ce1
parentb852236b26e0464c8c4ba3189846b128c9a5cdf6
gh-143006: Fix and optimize mixed comparison of float and int (GH-143084)

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.
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