You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
math.isqrt() returns incorrect results for int subclasses with overridden comparison operators #153200
math.isqrt() returns an incorrect result for an instance of an int
subclass with an overridden comparison operator if the argument is not
less than 2**64.
The arbitrary precision path ends with the check-and-correct comparison n < a*a, which calls the overridden __lt__, so the result can be
off by one. It is the only place where an overridden operator can be
picked up: all other operations use the value of the argument directly.
The bug exists since math.isqrt() was added in 3.8.
Activity
gh-153200: Fix math.isqrt() for int subclasses with overridden compar…
[3.14] gh-153200: Fix math.isqrt() for int subclasses with overridden…
[3.13] gh-153200: Fix math.isqrt() for int subclasses with overridden…
[3.15] gh-153200: Fix math.isqrt() for int subclasses with overridden…