diff -r ffc915a55a72 Python/random.c --- a/Python/random.c Mon Sep 05 00:01:47 2016 -0400 +++ b/Python/random.c Mon Sep 05 21:52:25 2016 +0900 @@ -121,7 +121,7 @@ /* Call getrandom() - Return 1 on success - - Return 0 if getrandom() syscall is not available (fails with ENOSYS). + - Return 0 if getrandom() syscall is not available (fails with ENOSYS or EPERM). - Raise an exception (if raise is non-zero) and return -1 on error: getrandom() failed with EINTR and the Python signal handler raised an exception, or getrandom() failed with a different error. */ @@ -181,7 +181,7 @@ #endif if (n < 0) { - if (errno == ENOSYS) { + if (errno == ENOSYS || errno == EPERM) { getrandom_works = 0; return 0; }