]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] 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:11:25 +0000 (21:11 +0200)
committerGitHub <noreply@github.com>
Mon, 6 Jul 2026 19:11:25 +0000 (19:11 +0000)
commite36fe3683c53abf0022a19061e60615c8801a306
tree1b8e71180997835b7708c14b2de85b8439644600
parentc0293f96bed73d83b628f725cf78ed95ba195e8d
[3.13] gh-153200: Fix math.isqrt() for int subclasses with overridden comparison operators (GH-153203) (GH-153225) (GH-153226)

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)
(cherry picked from commit a9a91d06a0e1faad9a56d4e652e4a7a98033adf8)

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