Author: Manuel Jacob <[email protected]>
Branch: py3k
Changeset: r83805:b2a4ce692ef4
Date: 2016-04-21 17:24 +0200
http://bitbucket.org/pypy/pypy/changeset/b2a4ce692ef4/

Log:    Raise NotImplementedError only when /dev/urandom is not present.
        Fixes app-level test.

diff --git a/pypy/module/posix/app_posix.py b/pypy/module/posix/app_posix.py
--- a/pypy/module/posix/app_posix.py
+++ b/pypy/module/posix/app_posix.py
@@ -3,6 +3,7 @@
 from __pypy__ import validate_fd
 
 # XXX we need a way to access the current module's globals more directly...
+import errno
 import sys
 if 'posix' in sys.builtin_module_names:
     import posix
@@ -135,5 +136,7 @@
         try:
             with open('/dev/urandom', 'rb', buffering=0) as fd:
                 return fd.read(n)
-        except (OSError, IOError):
-            raise NotImplementedError("/dev/urandom (or equivalent) not found")
+        except OSError as e:
+            if e.errno in (errno.ENOENT, errno.ENXIO, errno.ENODEV, 
errno.EACCES):
+                raise NotImplementedError("/dev/urandom (or equivalent) not 
found")
+            raise
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to