[issue27266] Always use getrandom() in os.random() on Linux and add block=False parameter to os.urandom()

Christian Heimes report at bugs.python.org
Thu Jun 9 04:11:14 EDT 2016


Christian Heimes added the comment:

I'm -1 on a block=True/False parameter. It makes the API more awkward and will make people move away from os.urandom() to a self-made RNG because they perceive os.urandom() as potential blocking.

Victor, you can use sysctl on all BSD and Linux to check if the RNG has been seeded. On Linux it is kernel.random.entropy_avail >= kernel.random.read_wakeup_threshold. On BSD it is kern.random.sys.seeded == 1.

----------

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


More information about the Python-bugs-list mailing list