diff options
author | Christian Heimes <christian@cheimes.de> | 2013-08-17 00:55:39 +0200 |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-08-17 00:55:39 +0200 |
commit | a3811e4b8f70790a3dc8768a455cb8836670de37 (patch) | |
tree | 000e0496c1fc58dd59ecede50e2cd756746f3cd9 /Python | |
parent | 824f7f366d1b54d2d3100c3130c04cf1dfb4b47c (diff) | |
parent | 7bf1125e9fe7fda150af3962c94f857b8461bfd7 (diff) | |
download | cpython-git-a3811e4b8f70790a3dc8768a455cb8836670de37.tar.gz |
merge
Diffstat (limited to 'Python')
-rw-r--r-- | Python/random.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Python/random.c b/Python/random.c index 53518c2ebe..e5caa828b5 100644 --- a/Python/random.c +++ b/Python/random.c @@ -165,8 +165,12 @@ dev_urandom_python(char *buffer, Py_ssize_t size) Py_END_ALLOW_THREADS if (fd < 0) { - PyErr_SetString(PyExc_NotImplementedError, - "/dev/urandom (or equivalent) not found"); + if (errno == ENOENT || errno == ENXIO || + errno == ENODEV || errno == EACCES) + PyErr_SetString(PyExc_NotImplementedError, + "/dev/urandom (or equivalent) not found"); + else + PyErr_SetFromErrno(PyExc_OSError); return -1; } |