[Python-Dev] BDFL ruling request: should we block forever waiting for high-quality random bits?

Tim Peters tim.peters at gmail.com
Fri Jun 10 15:16:30 EDT 2016


[David Mertz]
> OK.  My understanding is that Guido ruled out introducing an os.getrandom()
> API in 3.5.2.  But would you be happy if that interface is added to 3.6?
>
> It feels to me like the correct spelling in 3.6 should probably be
> secrets.getrandom() or something related to that.

secrets.token_bytes() is already the way to spell "get a string of
messed-up bytes", and that's the dead obvious (according to me) place
to add the potentially blocking implementation.  Indeed, everything in
the `secrets` module should block when the OS thinks that's needed.


More information about the Python-Dev mailing list