[Python-Dev] [Python-checkins] cpython (3.5): Fix os.urandom() using getrandom() on Linux
Larry Hastings
larry at hastings.org
Wed Jun 15 01:41:32 EDT 2016
On 06/14/2016 08:07 AM, Steven D'Aprano wrote:
> Is this right? I thought we had decided that os.urandom should *not*
> fall back on getrandom on Linux?
We decided that os.urandom() should not *block* on Linux. Which it
doesn't; we now strictly call getrandom(GRND_NONBLOCK), which will never
block. getrandom() is better because it's a system call, instead of
reading from a file. So it's much less messy.
If getrandom() wanted to block, instead it'll return EAGAIN, and we'll
fail over to reading from /dev/urandom directly, just like we did in 3.4
and before.
It's all working as intended,
//arry/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160614/a0deadbe/attachment.html>
More information about the Python-Dev
mailing list