]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.15] gh-153200: Fix math.isqrt() for int subclasses with overridden comparison...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 6 Jul 2026 19:17:26 +0000 (21:17 +0200)
committerGitHub <noreply@github.com>
Mon, 6 Jul 2026 19:17:26 +0000 (19:17 +0000)
commitcca9d1c3628c1e1c5774d2c14e0dca089bedc23b
tree406119f5081e64c1228ca3b6dfc2ece7880d4baa
parent9d603d3c12b8365ef2db26746ec1f21855c98927
[3.15] gh-153200: Fix math.isqrt() for int subclasses with overridden comparison operators (GH-153203) (GH-153223)

The final check-and-correct comparison in the arbitrary precision path
could call a comparison operator overridden in an int subclass.
Compare by value with int's tp_richcompare.
(cherry picked from commit 3a1b5473f217fc493f743c9ca8b877d2e76f8e6b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/test/test_math_integer.py
Misc/NEWS.d/next/Library/2026-07-06-12-00-00.gh-issue-153200.isqrtLt.rst [new file with mode: 0644]
Modules/mathintegermodule.c