[issue27776] PEP 524: Make os.urandom() blocking on Linux

STINNER Victor report at bugs.python.org
Fri Aug 19 08:28:58 EDT 2016


STINNER Victor added the comment:

Enhanced patch to address Nick's comments and fix mistakes. The new patch now also updates the documentation.

I restored the code in _random.Random.seed() to fallback on the system clock: _PyOS_URandomNonblock() *can* fail is /dev/urandom is missing or not readable. I enhanced this part to not only read the system clock, but also use the current process identifier and get also the monotonic clock. Moreover, 64 bits are now used instead of 32 bits from the system clock (use a resolution of 1 nanoscond, not only 1 second).

I didn't test yet the fall back on clocks/pid. It should be tested manually by modifying _PyOS_URandomNonblock() to always fail.

----------
Added file: http://bugs.python.org/file44150/urandom_nonblock-2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27776>
_______________________________________


More information about the Python-bugs-list mailing list