[New-bugs-announce] [issue27266] Add block keyword-only optional parameter to os.urandom()

STINNER Victor report at bugs.python.org
Wed Jun 8 05:19:03 EDT 2016


New submission from STINNER Victor:

Follow-up of the issue #26839: I propose to add a "block" keyword-only optional parameter to os.urandom(). I chose to make the parameter a keyword-only to avoid suprises and backward incompatible change and because I want to make this change in Python 3.5.2.

The attached patch:

* add block parameter to os.urandom()
* modify random.Random constructor to call os.urandom() with block=False
* modify _PyOS_URandom() to add a block parameter
* modify dev_urandom_noraise() to not block

The block parameter currently only changes the behaviour on Linux when the getrandom() syscall is used and the urandom entropy pool is not initialized.

With the change, os.urandom() blocks by default, but Python startup and "import random" doesn't block even if the urandom entropy pool is not initialized yet.

----------
files: urandom_block.patch
keywords: patch
messages: 267814
nosy: haypo
priority: normal
severity: normal
status: open
title: Add block keyword-only optional parameter to os.urandom()
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file43304/urandom_block.patch

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


More information about the New-bugs-announce mailing list