diff -r e908e90fb147 Python/random.c --- a/Python/random.c Fri Jan 06 09:44:36 2017 +0100 +++ b/Python/random.c Sat Jan 07 02:43:27 2017 +0100 @@ -97,8 +97,14 @@ win32_urandom(unsigned char *buffer, Py_ } /* Issue #25003: Don't use getentropy() on Solaris (available since - * Solaris 11.3), it is blocking whereas os.urandom() should not block. */ -#elif defined(HAVE_GETENTROPY) && !defined(sun) + Solaris 11.3), it is blocking whereas os.urandom() should not block. + Issue #29188: Don't use getentropy() on Linux since the glibc 2.24 + implements it with the getrandom() syscall which can fail with ENOSYS, + and this error is not supported in py_getentropy() and getrandom() is called + with flags=0 which blocks until system urandom is initialized, which is not + the desired behaviour to seed the Python hash secret nor for os.urandom(): + see the PEP 524 which was only implemented in Python 3.6. */ +#elif defined(HAVE_GETENTROPY) && !defined(sun) && !defined(linux) #define PY_GETENTROPY 1 /* Fill buffer with size pseudo-random bytes generated by getentropy().