]> granicus.if.org Git - python/commitdiff
Issue #15340: Fix importing the random module when /dev/urandom cannot be opened.
authorAntoine Pitrou <solipsis@pitrou.net>
Fri, 7 Sep 2012 21:49:07 +0000 (23:49 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Fri, 7 Sep 2012 21:49:07 +0000 (23:49 +0200)
This was a regression caused by the hash randomization patch.

Misc/NEWS
Python/random.c

index 04a98abf81a33f88b1e37c735507325d86d05ed5..946ac46467a422fad7b865f0656b47f7122017f3 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -18,6 +18,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #15340: Fix importing the random module when /dev/urandom cannot
+  be opened.  This was a regression caused by the hash randomization patch.
+
 - Issue #15785: Modify window.get_wch() API of the curses module: return
   a character for most keys, and an integer for special keys, instead of
   always returning an integer. So it is now possible to distinguish special
index 7019a3503e8f95e5440189e63fd5740a54003f8d..53518c2ebec679155829a2a68c02a47a8fc81fb1 100644 (file)
@@ -165,7 +165,8 @@ dev_urandom_python(char *buffer, Py_ssize_t size)
     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;
     }