[Python-checkins] cpython (3.6): fix error check, so that Random.seed actually uses OS randomness (closes #29085)
benjamin.peterson
python-checkins at python.org
Wed Dec 28 23:03:28 EST 2016
https://hg.python.org/cpython/rev/0a55e039d25f
changeset: 105885:0a55e039d25f
branch: 3.6
parent: 105883:af8c8551ea45
user: Benjamin Peterson <benjamin at python.org>
date: Wed Dec 28 20:02:35 2016 -0800
summary:
fix error check, so that Random.seed actually uses OS randomness (closes #29085)
files:
Misc/NEWS | 3 +++
Modules/_randommodule.c | 2 +-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -40,6 +40,9 @@
Library
-------
+- Issue #29085: Allow random.Random.seed() to use high quality OS randomness
+ rather than the pid and time.
+
- Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows
- Issue #13051: Fixed recursion errors in large or resized
diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c
--- a/Modules/_randommodule.c
+++ b/Modules/_randommodule.c
@@ -245,7 +245,7 @@
return NULL;
if (arg == NULL || arg == Py_None) {
- if (random_seed_urandom(self) >= 0) {
+ if (random_seed_urandom(self) < 0) {
PyErr_Clear();
/* Reading system entropy failed, fall back on the worst entropy:
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list