diff Python/random.c @ 78875:edbf37ace03c 2.7

Issue #15340: Fix importing the random module when /dev/urandom cannot be opened. This was a regression caused by the hash randomization patch.
author Antoine Pitrou <solipsis@pitrou.net>
date Fri, 07 Sep 2012 23:49:07 +0200
parents 357e268e7c5f
children ec296a36156b
line wrap: on
line diff
--- a/Python/random.c	Fri Sep 07 00:55:33 2012 +0200
+++ b/Python/random.c	Fri Sep 07 23:49:07 2012 +0200
@@ -165,7 +165,8 @@
     Py_END_ALLOW_THREADS
     if (fd < 0)
     {
-        PyErr_SetFromErrnoWithFilename(PyExc_OSError, "/dev/urandom");
+        PyErr_SetString(PyExc_NotImplementedError,
+                        "/dev/urandom (or equivalent) not found");
         return -1;
     }