Fix error check, so that Random.seed actually uses OS randomness (rhbz#1412275)
This commit is contained in:
parent
2294d6496c
commit
79728f702e
2 changed files with 24 additions and 1 deletions
13
00254-make-Random.seed-actually-use-OS-randomness.patch
Normal file
13
00254-make-Random.seed-actually-use-OS-randomness.patch
Normal 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:
|
||||
Loading…
Add table
Add a link
Reference in a new issue