os.urandom() now blocks on Linux

Issue #27776: The os.urandom() function does now block on Linux 3.17 and newer
until the system urandom entropy pool is initialized to increase the security.

This change is part of the PEP 524.
This commit is contained in:
Victor Stinner 2016-09-06 16:33:52 -07:00
parent e256accd46
commit e66987e626
8 changed files with 130 additions and 59 deletions

View file

@ -11168,8 +11168,7 @@ os_urandom_impl(PyObject *module, Py_ssize_t size)
if (bytes == NULL)
return NULL;
result = _PyOS_URandom(PyBytes_AS_STRING(bytes),
PyBytes_GET_SIZE(bytes));
result = _PyOS_URandom(PyBytes_AS_STRING(bytes), PyBytes_GET_SIZE(bytes));
if (result == -1) {
Py_DECREF(bytes);
return NULL;