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

Larry Hastings larry at hastings.org
Thu Jun 9 22:54:51 EDT 2016

On 06/09/2016 07:38 PM, Nikolaus Rath wrote:
> On Jun 09 2016, Larry Hastings <larry at hastings.org> wrote:
>> Nope, I want the old behavior back.  os.urandom() should read
>> /dev/random if getrandom() would block.  As the British say, "it
>> should do what it says on the tin".
> Aeh, what the tin says is "return random bytes".

What the tin says is "urandom", which has local man pages that dictate 
exactly how it behaves.  On Linux the "urandom" man page says:

    A read from the /dev/urandom device will not block waiting for more
    entropy.  If there is not sufficient entropy, a pseudorandom number
    generator is used to create the requested bytes.

os.urandom() needs to behave like that on Linux, which is how it behaved 
in Python 2.4 through 3.4.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160609/2ec86519/attachment.html>

More information about the Python-Dev mailing list