-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
regression in 3.13.4 Random.getrandbits
when an int
like object is passed
#135326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Random.getrandbits
when an int
subclass is passedRandom.getrandbits
when an int
like object is passed
…ions on getrandbits() and randbytes() (pythonGH-133658) (pythonGH-134965)" This reverts commit 3e1b8d6. This caused a regression in Python 3.13.4, getrandbit() no longer accepted an integer-like object via `__index__`.
I went for a revert of the change. Easiest. We can live without that old bug being fixed in 3.13. The fix works in 3.14+. |
#135332 restores support without rolling back all changes. Note that |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
via #133489 (comment) @tornaria reports:
There is an (unintended?) api break. In python 3.13.3,
getrandbits()
accepts an "integer-like" object as in:but in python 3.13.4,
getrandbits()
fails as in:This causes trouble for sagemath, where integers are by default a special type
ZZ
.CPython versions tested on:
3.13
Operating systems tested on:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: