Martin Panter added the comment:
It looks like the logic for handling an error seeding from urandom is reversed:
<https://hg.python.org/cpython/rev/45fc0c83ed42#l6.66>. Random_seed_urandom()
actually returns -1 if is an exception set, and 0 if it was successful.
The result would be a normal working urandom setup ignores urandom and seeds
from the time and PID. Not a big deal, since the old code always seeded from a
(lower resolution) time anyway. But if urandom failed, we get the SystemError.
The fix should be simple, in Modules/_randommodule.c change the random_seed()
function to read
if (arg == NULL || arg == Py_None) {
if (random_seed_urandom(self) < 0) { // was >= 0!
PyErr_Clear();
/* Reading system entropy failed, fall back on the worst entropy:
use the current time and process identifier. */
random_seed_time_pid(self);
}
Py_RETURN_NONE;
}
----------
keywords: +3.6regression
nosy: +haypo, martin.panter
type: -> behavior
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29208>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com