]> granicus.if.org Git - python/commitdiff
fix error check, so that Random.seed actually uses OS randomness (closes #29085)
authorBenjamin Peterson <benjamin@python.org>
Thu, 29 Dec 2016 04:02:35 +0000 (20:02 -0800)
committerBenjamin Peterson <benjamin@python.org>
Thu, 29 Dec 2016 04:02:35 +0000 (20:02 -0800)
Misc/NEWS
Modules/_randommodule.c

index 1112257a28afc02780a89a17a8d18cef42545bbf..3436c0a52fbe5f69c939cd0f67ac704c2b52bbc2 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -40,6 +40,9 @@ Core and Builtins
 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
index 63759d5562489c79357b2216071ff3521e0723be..0d3282db8f2810c6c9e1a22e3874d7d237bd7a3a 100644 (file)
@@ -245,7 +245,7 @@ random_seed(RandomObject *self, PyObject *args)
         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: