René's URL Explorer Experiment


Title: bpo-40286: Add randbytes() method to random.Random by vstinner · Pull Request #19527 · python/cpython · GitHub

Open Graph Title: bpo-40286: Add randbytes() method to random.Random by vstinner · Pull Request #19527 · python/cpython

X Title: bpo-40286: Add randbytes() method to random.Random by vstinner · Pull Request #19527 · python/cpython

Description: Add random.randbytes() function and random.Random.randbytes() method to generate random bytes. Modify secrets.token_bytes() to use SystemRandom.randbytes() rather than calling directly os.urandom(). Rename also genrand_int32() to genrand_uint32(), since it returns an unsigned 32-bit integer, not a signed integer. https://bugs.python.org/issue40286

Open Graph Description: Add random.randbytes() function and random.Random.randbytes() method to generate random bytes. Modify secrets.token_bytes() to use SystemRandom.randbytes() rather than calling directly os.urandom()...

X Description: Add random.randbytes() function and random.Random.randbytes() method to generate random bytes. Modify secrets.token_bytes() to use SystemRandom.randbytes() rather than calling directly os.urandom()...

Opengraph URL: https://github.com/python/cpython/pull/19527

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:1e076114-bf21-d9b2-13ba-c5a473bbf709
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC6CC:D73F2:1607BD:1E5041:696A9BF7
html-safe-nonce8bf1e7fb6e21fdb06bbf3b4b425820180e4fe4ad052bb380bfa69bf272ddc625
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNkNDOkQ3M0YyOjE2MDdCRDoxRTUwNDE6Njk2QTlCRjciLCJ2aXNpdG9yX2lkIjoiMjc0OTAzMzYxNjc0MDM1OTE1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac1a188239fd48e43200e653d72b3f20fcf21fc3a27eaedc0343244c762b5e0c91
hovercard-subject-tagpull_request:403448109
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/19527/files
twitter:imagehttps://avatars.githubusercontent.com/u/194129?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/194129?s=400&v=4
og:image:altAdd random.randbytes() function and random.Random.randbytes() method to generate random bytes. Modify secrets.token_bytes() to use SystemRandom.randbytes() rather than calling directly os.urandom()...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonec0d8175e41e0e55b9e984c935b24b808cabab919dd3174aa45dac3ef503ed1af
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release99aab454e5ddc8df30805fb76c114c3008a15842
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/19527/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F19527%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F19527%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/19527/files
Reloadhttps://github.com/python/cpython/pull/19527/files
Reloadhttps://github.com/python/cpython/pull/19527/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/19527/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/pull/19527/files
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
vstinnerhttps://github.com/vstinner
python:masterhttps://github.com/python/cpython/tree/master
Conversation 38 https://github.com/python/cpython/pull/19527
Commits 1 https://github.com/python/cpython/pull/19527/commits
Checks 0 https://github.com/python/cpython/pull/19527/checks
Files changed https://github.com/python/cpython/pull/19527/files
Please reload this pagehttps://github.com/python/cpython/pull/19527/files
bpo-40286: Add randbytes() method to random.Random https://github.com/python/cpython/pull/19527/files#top
Show all changes 1 commit https://github.com/python/cpython/pull/19527/files
f60ea03 bpo-40286: Add randbytes() method to random.Random vstinner Apr 14, 2020 https://github.com/python/cpython/pull/19527/commits/f60ea030ab12be7613fcaf9322bd05e831ba33c3
Clear filters https://github.com/python/cpython/pull/19527/files
Please reload this pagehttps://github.com/python/cpython/pull/19527/files
Please reload this pagehttps://github.com/python/cpython/pull/19527/files
random.rst https://github.com/python/cpython/pull/19527/files#diff-487697e65cad630537366129288e300806c018e1ec7613cd35909e6db5299794
3.9.rst https://github.com/python/cpython/pull/19527/files#diff-ec874d66bbcf13046b9928aa3716d14a93632f568b914eba32baf46ff4c9eb36
random.py https://github.com/python/cpython/pull/19527/files#diff-851cf2d8d99b6d8dee26acc31319431dce51dbe26e3e56494d9b4c45edd8e11f
secrets.py https://github.com/python/cpython/pull/19527/files#diff-325b0823de836217e1dfa2689130df5a195bb6dc5dc16387c7bd59836108b9a8
test_random.py https://github.com/python/cpython/pull/19527/files#diff-aaebf638f7ed6fb71bd1b82f18d5ef343db5b52137304a86fdcd1dd176e9eda9
2020-04-15-00-39-25.bpo-40286.ai80FA.rst https://github.com/python/cpython/pull/19527/files#diff-cc0ac1ae19d1a9fff46f5f1c2d3f3c5f6e1d186cc9eb1ad51d24a218453031f6
Setup https://github.com/python/cpython/pull/19527/files#diff-54b4e964e44dd7cf194c63f73a4b01d68cc670e72018d895003b48709c7e88db
_randommodule.c https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
_randommodule.c.h https://github.com/python/cpython/pull/19527/files#diff-f2bc9bc8f92c7ecb7ed10916d2c5ff9de9748e53ecd76ce027de797ca281bba5
setup.py https://github.com/python/cpython/pull/19527/files#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7
Doc/library/random.rsthttps://github.com/python/cpython/pull/19527/files#diff-487697e65cad630537366129288e300806c018e1ec7613cd35909e6db5299794
View file https://github.com/python/cpython/blob/f60ea030ab12be7613fcaf9322bd05e831ba33c3/Doc/library/random.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19527/{{ revealButtonHref }}
https://github.com/python/cpython/pull/19527/files#diff-487697e65cad630537366129288e300806c018e1ec7613cd35909e6db5299794
https://github.com/python/cpython/pull/19527/files#diff-487697e65cad630537366129288e300806c018e1ec7613cd35909e6db5299794
Doc/whatsnew/3.9.rsthttps://github.com/python/cpython/pull/19527/files#diff-ec874d66bbcf13046b9928aa3716d14a93632f568b914eba32baf46ff4c9eb36
View file https://github.com/python/cpython/blob/f60ea030ab12be7613fcaf9322bd05e831ba33c3/Doc/whatsnew/3.9.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19527/{{ revealButtonHref }}
https://github.com/python/cpython/pull/19527/files#diff-ec874d66bbcf13046b9928aa3716d14a93632f568b914eba32baf46ff4c9eb36
https://github.com/python/cpython/pull/19527/files#diff-ec874d66bbcf13046b9928aa3716d14a93632f568b914eba32baf46ff4c9eb36
Lib/random.pyhttps://github.com/python/cpython/pull/19527/files#diff-851cf2d8d99b6d8dee26acc31319431dce51dbe26e3e56494d9b4c45edd8e11f
View file https://github.com/python/cpython/blob/f60ea030ab12be7613fcaf9322bd05e831ba33c3/Lib/random.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19527/{{ revealButtonHref }}
https://github.com/python/cpython/pull/19527/files#diff-851cf2d8d99b6d8dee26acc31319431dce51dbe26e3e56494d9b4c45edd8e11f
https://github.com/python/cpython/pull/19527/files#diff-851cf2d8d99b6d8dee26acc31319431dce51dbe26e3e56494d9b4c45edd8e11f
https://github.com/python/cpython/pull/19527/files#diff-851cf2d8d99b6d8dee26acc31319431dce51dbe26e3e56494d9b4c45edd8e11f
https://github.com/python/cpython/pull/19527/files#diff-851cf2d8d99b6d8dee26acc31319431dce51dbe26e3e56494d9b4c45edd8e11f
Lib/secrets.pyhttps://github.com/python/cpython/pull/19527/files#diff-325b0823de836217e1dfa2689130df5a195bb6dc5dc16387c7bd59836108b9a8
View file https://github.com/python/cpython/blob/f60ea030ab12be7613fcaf9322bd05e831ba33c3/Lib/secrets.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19527/{{ revealButtonHref }}
https://github.com/python/cpython/pull/19527/files#diff-325b0823de836217e1dfa2689130df5a195bb6dc5dc16387c7bd59836108b9a8
https://github.com/python/cpython/pull/19527/files#diff-325b0823de836217e1dfa2689130df5a195bb6dc5dc16387c7bd59836108b9a8
https://github.com/python/cpython/pull/19527/files#diff-325b0823de836217e1dfa2689130df5a195bb6dc5dc16387c7bd59836108b9a8
https://github.com/python/cpython/pull/19527/files#diff-325b0823de836217e1dfa2689130df5a195bb6dc5dc16387c7bd59836108b9a8
Lib/test/test_random.pyhttps://github.com/python/cpython/pull/19527/files#diff-aaebf638f7ed6fb71bd1b82f18d5ef343db5b52137304a86fdcd1dd176e9eda9
View file https://github.com/python/cpython/blob/f60ea030ab12be7613fcaf9322bd05e831ba33c3/Lib/test/test_random.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19527/{{ revealButtonHref }}
https://github.com/python/cpython/pull/19527/files#diff-aaebf638f7ed6fb71bd1b82f18d5ef343db5b52137304a86fdcd1dd176e9eda9
https://github.com/python/cpython/pull/19527/files#diff-aaebf638f7ed6fb71bd1b82f18d5ef343db5b52137304a86fdcd1dd176e9eda9
https://github.com/python/cpython/pull/19527/files#diff-aaebf638f7ed6fb71bd1b82f18d5ef343db5b52137304a86fdcd1dd176e9eda9
https://github.com/python/cpython/pull/19527/files#diff-aaebf638f7ed6fb71bd1b82f18d5ef343db5b52137304a86fdcd1dd176e9eda9
Misc/NEWS.d/next/Library/2020-04-15-00-39-25.bpo-40286.ai80FA.rsthttps://github.com/python/cpython/pull/19527/files#diff-cc0ac1ae19d1a9fff46f5f1c2d3f3c5f6e1d186cc9eb1ad51d24a218453031f6
View file https://github.com/python/cpython/blob/f60ea030ab12be7613fcaf9322bd05e831ba33c3/Misc/NEWS.d/next/Library/2020-04-15-00-39-25.bpo-40286.ai80FA.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19527/{{ revealButtonHref }}
Modules/Setuphttps://github.com/python/cpython/pull/19527/files#diff-54b4e964e44dd7cf194c63f73a4b01d68cc670e72018d895003b48709c7e88db
View file https://github.com/python/cpython/blob/f60ea030ab12be7613fcaf9322bd05e831ba33c3/Modules/Setup
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19527/{{ revealButtonHref }}
https://github.com/python/cpython/pull/19527/files#diff-54b4e964e44dd7cf194c63f73a4b01d68cc670e72018d895003b48709c7e88db
https://github.com/python/cpython/pull/19527/files#diff-54b4e964e44dd7cf194c63f73a4b01d68cc670e72018d895003b48709c7e88db
Modules/_randommodule.chttps://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
View file https://github.com/python/cpython/blob/f60ea030ab12be7613fcaf9322bd05e831ba33c3/Modules/_randommodule.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19527/{{ revealButtonHref }}
https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
Please reload this pagehttps://github.com/python/cpython/pull/19527/files
https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
https://github.com/python/cpython/pull/19527/files#diff-c2608f08e5410416046fb2fc953730740d0b29b26c148c2cb4a40e87212012fa
Modules/clinic/_randommodule.c.hhttps://github.com/python/cpython/pull/19527/files#diff-f2bc9bc8f92c7ecb7ed10916d2c5ff9de9748e53ecd76ce027de797ca281bba5
View file https://github.com/python/cpython/blob/f60ea030ab12be7613fcaf9322bd05e831ba33c3/Modules/clinic/_randommodule.c.h
Open in desktop https://desktop.github.com
how customized files appear on GitHubhttps://docs.github.com/github/administering-a-repository/customizing-how-changed-files-appear-on-github
Please reload this pagehttps://github.com/python/cpython/pull/19527/files
setup.pyhttps://github.com/python/cpython/pull/19527/files#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7
View file https://github.com/python/cpython/blob/f60ea030ab12be7613fcaf9322bd05e831ba33c3/setup.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19527/{{ revealButtonHref }}
https://github.com/python/cpython/pull/19527/files#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7
https://github.com/python/cpython/pull/19527/files#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.