https://github.com/python/cpython/commit/c885978bb600ac94012776877070381a50e4d4f2
commit: c885978bb600ac94012776877070381a50e4d4f2
branch: main
author: Kirti Aggarwal <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-11-17T20:11:54Z
summary:

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

Co-authored-by: Stan Ulbrych <[email protected]>

files:
M Doc/library/os.rst

diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 7f4b698eac38cd..9cf4a4efe5c0ee 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -6466,9 +6466,12 @@ Random numbers
    random bytes in non-blocking mode (using the :data:`GRND_NONBLOCK` flag) or
    to poll until the system urandom entropy pool is initialized.
 
-   On a Unix-like system, random bytes are read from the ``/dev/urandom``
-   device. If the ``/dev/urandom`` device is not available or not readable, the
-   :exc:`NotImplementedError` exception is raised.
+   On other Unix-like systems, the C ``getrandom()`` function is used if it is
+   available, otherwise the C ``getentropy()`` function.
+
+   If none of these functions can be used, random bytes are read from the
+   ``/dev/urandom`` device. If the ``/dev/urandom`` device is not available or
+   not readable, the :exc:`NotImplementedError` exception is raised.
 
    On Windows, it will use ``BCryptGenRandom()``.
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to