File tree Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -5732,8 +5732,8 @@ Random numbers
57325732 ``/dev/urandom `` devices.
57335733
57345734 The flags argument is a bit mask that can contain zero or more of the
5735- following values ORed together: :py:const: `os.GRND_RANDOM ` and
5736- :py:data: `GRND_NONBLOCK `.
5735+ following values ORed together: :py:const: `os.GRND_RANDOM `,
5736+ :py:data: `GRND_NONBLOCK ` and :py:data: ` GRND_INSECURE ` .
57375737
57385738 See also the `Linux getrandom() manual page
57395739 <https://man7.org/linux/man-pages/man2/getrandom.2.html> `_.
@@ -5803,3 +5803,15 @@ Random numbers
58035803 ``/dev/random `` pool instead of the ``/dev/urandom `` pool.
58045804
58055805 .. versionadded :: 3.6
5806+
5807+ .. data :: GRND_INSECURE
5808+
5809+ If this flag is set, then :func: `getrandom ` will return pseudo-random data
5810+ even if the entropy pool has not yet been initialized.
5811+ (It cannot be used with :py:const: `os.GRND_RANDOM `.)
5812+
5813+ .. note ::
5814+
5815+ It is not suitable for scenarios requiring secure cryptography.
5816+
5817+ .. versionadded :: next
Original file line number Diff line number Diff line change 491491 same process.
492492 (Contributed by Victor Stinner in :gh: `120057 `.)
493493
494+ * Add the :data: `~os.GRND_INSECURE ` constant to the :mod: `os ` module.
495+ (Contributed by James Roy in :gh: `127776 `.)
496+
494497
495498pathlib
496499-------
Original file line number Diff line number Diff line change 1+ Add the :data: `~os.GRND_INSECURE ` constant to the :mod: `os ` module.
Original file line number Diff line number Diff line change @@ -17613,6 +17613,8 @@ all_ins(PyObject *m)
1761317613#ifdef HAVE_GETRANDOM_SYSCALL
1761417614 if (PyModule_AddIntMacro (m , GRND_RANDOM )) return -1 ;
1761517615 if (PyModule_AddIntMacro (m , GRND_NONBLOCK )) return -1 ;
17616+ /* Linux 5.6+ */
17617+ if (PyModule_AddIntMacro (m , GRND_INSECURE )) return -1 ;
1761617618#endif
1761717619#ifdef HAVE_MEMFD_CREATE
1761817620 if (PyModule_AddIntMacro (m , MFD_CLOEXEC )) return -1 ;
You can’t perform that action at this time.
0 commit comments