python2/00171-raise-correct-exception-when-dev-urandom-is-missing.patch
David Malcolm c9c381fa33 2.7.3-26: raise correct exception in os.urandom() when /dev/urandom is missing (patch 171; rhbz#907383)
* Thu Feb 21 2013 David Malcolm <dmalcolm@redhat.com> - 2.7.3-26
- raise correct exception in os.urandom() when /dev/urandom is missing
(patch 171; rhbz#907383)
2013-02-21 14:44:28 -05:00

15 lines
748 B
Diff

diff -up Python-2.7.3/Misc/NEWS.raise-correct-exception-when-dev-urandom-is-missing Python-2.7.3/Misc/NEWS
diff -up Python-2.7.3/Python/random.c.raise-correct-exception-when-dev-urandom-is-missing Python-2.7.3/Python/random.c
--- Python-2.7.3/Python/random.c.raise-correct-exception-when-dev-urandom-is-missing 2012-04-09 19:07:35.000000000 -0400
+++ Python-2.7.3/Python/random.c 2013-02-21 14:39:01.020988043 -0500
@@ -165,7 +165,8 @@ dev_urandom_python(char *buffer, Py_ssiz
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;
}