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 <rep...@bugs.python.org>
<http://bugs.python.org/issue27266>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to