Fix error check, so that Random.seed actually uses OS randomness (rhbz#1412275)

This commit is contained in:
Charalampos Stratakis 2017-01-16 14:28:13 +01:00
commit 79728f702e
2 changed files with 24 additions and 1 deletions

View file

@ -0,0 +1,13 @@
diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c
index 63759d5..0d3282d 100644
--- a/Modules/_randommodule.c
+++ b/Modules/_randommodule.c
@@ -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: