-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-133489: Remove size restrictions on getrandbits() and randbytes() #133658
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
gh-133489: Remove size restrictions on getrandbits() and randbytes() #133658
Conversation
…tes() random.getrandbits() can now generate more that 2**31 bits. random.randbytes() can now generate more that 256 MiB.
@@ -806,6 +806,20 @@ def test_getrandbits(self): | |||
self.assertEqual(self.gen.getrandbits(100), | |||
97904845777343510404718956115) | |||
|
|||
def test_getrandbits_2G_bits(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be decorated with bigmemtest? Ditto the second test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It requires only 800 MB of memory. Too small for bigmemtest. The second test requires about 1300 MB of memory. This may be too small too, but I'm going to add bigmemtest after testing on 32-bit buildbots.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It requires only 800 MB of memory. Too small for bigmemtest.
Where is the boundary? IIRC, memory limit is configurable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was 1GiB (you could not specify less than 1 GiB for -M option in regrtest). But now it seems is 2 GiB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it was initially 2.5 GiB, then lowered to 2 GiB. But I add bigmemtest even for some tests that need 1-2 GiB.
!buildbot 32 |
🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit 24cbd8d 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F133658%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
!buildbot android |
🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit 24cbd8d 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F133658%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also consider tagging any of the new tests that take a long time to run (especially from a GH CI perspective) as @support.requires_resource("cpu")
.
The new non-bigmem test takes 1 second on my computer. I usually only mark tests that take more than 5 seconds.
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…tes() (pythonGH-133658) random.getrandbits() can now generate more that 2**31 bits. random.randbytes() can now generate more that 256 MiB. (cherry picked from commit 68784fe) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sorry, @serhiy-storchaka, I could not cleanly backport this to
|
GH-134964 is a backport of this pull request to the 3.14 branch. |
… randbytes() (pythonGH-133658) random.getrandbits() can now generate more that 2**31 bits. random.randbytes() can now generate more that 256 MiB. (cherry picked from commit 68784fe) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
GH-134965 is a backport of this pull request to the 3.13 branch. |
…ytes() (GH-133658) (#134964) gh-133489: Remove size restrictions on getrandbits() and randbytes() (GH-133658) random.getrandbits() can now generate more that 2**31 bits. random.randbytes() can now generate more that 256 MiB. (cherry picked from commit 68784fe) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
random.getrandbits() can now generate more that 2**31 bits. random.randbytes() can now generate more that 256 MiB.