Skip to content

gh-116245: Document getentropy() use in os.urandom() - #162108

Merged
StanFromIreland merged 2 commits into
python:mainfrom
kirtiagwl1595:gh-116245-urandom-getentropy
Nov 17, 2026
Merged

StanFromIreland merged 2 commits into
python:mainfrom
kirtiagwl1595:gh-116245-urandom-getentropy

Conversation

@kirtiagwl1595

Copy link
Copy Markdown
Contributor

As Ronald Oussoren explained in the issue, os.urandom() uses getentropy() on macOS 10.12 and newer and on OpenBSD, but the docs mention only /dev/urandom for Unix-like systems; getentropy() appears only in a 3.5 versionchanged note. This change follows that diagnosis, not the issue title: CCRandomGenerateBytes is not used. The Unix paragraph now names getrandom() and getentropy(), and keeps the /dev/urandom fallback for all Unix-like systems, which matches pyurandom() in Python/bootstrap_hash.c.

This needs the skip news label (docs only).

I used Claude Code to research and draft this change; I reviewed every line.

Comment thread Doc/library/os.rst Resolved
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35965208 | 📁 Comparing 98a08aa against main (c7fef83)

  🔍 Preview build  

1 file changed
± library/os.html

@StanFromIreland StanFromIreland added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 17, 2026
@StanFromIreland
StanFromIreland merged commit c885978 into python:main Nov 17, 2026
39 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Nov 17, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @kirtiagwl1595 for the PR, and @StanFromIreland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@bedevere-app

bedevere-app Bot commented Nov 17, 2026

Copy link
Copy Markdown

GH-162171 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 17, 2026
@bedevere-app

bedevere-app Bot commented Nov 17, 2026

Copy link
Copy Markdown

GH-162172 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 17, 2026
StanFromIreland added a commit that referenced this pull request Nov 17, 2026
…62108) (#162172)

(cherry picked from commit c885978)

Co-authored-by: Kirti Aggarwal <47375858+kirtiagwl1595@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
StanFromIreland added a commit that referenced this pull request Nov 17, 2026
…62108) (#162171)

(cherry picked from commit c885978)

Co-authored-by: Kirti Aggarwal <47375858+kirtiagwl1595@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants