diff -r ef9346be45d0 Lib/test/test_os.py --- a/Lib/test/test_os.py Mon Sep 07 22:51:56 2015 +0300 +++ b/Lib/test/test_os.py Mon Sep 07 23:54:12 2015 +0200 @@ -1101,10 +1101,6 @@ class URandomTests(unittest.TestCase): self.assertNotEqual(data1, data2) -HAVE_GETENTROPY = (sysconfig.get_config_var('HAVE_GETENTROPY') == 1) - -@unittest.skipIf(HAVE_GETENTROPY, - "getentropy() does not use a file descriptor") class URandomFDTests(unittest.TestCase): @unittest.skipUnless(resource, "test requires the resource module") def test_urandom_failure(self): diff -r ef9346be45d0 Python/random.c --- a/Python/random.c Mon Sep 07 22:51:56 2015 +0300 +++ b/Python/random.c Mon Sep 07 23:54:12 2015 +0200 @@ -67,41 +67,6 @@ win32_urandom(unsigned char *buffer, Py_ return 0; } -#elif HAVE_GETENTROPY -/* Fill buffer with size pseudo-random bytes generated by getentropy(). - Return 0 on success, or raise an exception and return -1 on error. - - If fatal is nonzero, call Py_FatalError() instead of raising an exception - on error. */ -static int -py_getentropy(unsigned char *buffer, Py_ssize_t size, int fatal) -{ - while (size > 0) { - Py_ssize_t len = Py_MIN(size, 256); - int res; - - if (!fatal) { - Py_BEGIN_ALLOW_THREADS - res = getentropy(buffer, len); - Py_END_ALLOW_THREADS - - if (res < 0) { - PyErr_SetFromErrno(PyExc_OSError); - return -1; - } - } - else { - res = getentropy(buffer, len); - if (res < 0) - Py_FatalError("getentropy() failed"); - } - - buffer += len; - size -= len; - } - return 0; -} - #else static struct { int fd; @@ -275,8 +240,6 @@ int #ifdef MS_WINDOWS return win32_urandom((unsigned char *)buffer, size, 1); -#elif HAVE_GETENTROPY - return py_getentropy(buffer, size, 0); #else return dev_urandom_python((char*)buffer, size); #endif @@ -322,8 +285,6 @@ void else { #ifdef MS_WINDOWS (void)win32_urandom(secret, secret_size, 0); -#elif HAVE_GETENTROPY - (void)py_getentropy(secret, secret_size, 1); #else dev_urandom_noraise(secret, secret_size); #endif diff -r ef9346be45d0 configure --- a/configure Mon Sep 07 22:51:56 2015 +0300 +++ b/configure Mon Sep 07 23:54:12 2015 +0200 @@ -10545,7 +10545,7 @@ fi for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ clock confstr ctermid dup3 execv faccessat fchmod fchmodat fchown fchownat \ fexecve fdopendir fork fpathconf fstatat ftime ftruncate futimesat \ - futimens futimes gai_strerror getentropy \ + futimens futimes gai_strerror \ getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ if_nameindex \ diff -r ef9346be45d0 configure.ac --- a/configure.ac Mon Sep 07 22:51:56 2015 +0300 +++ b/configure.ac Mon Sep 07 23:54:12 2015 +0200 @@ -2945,7 +2945,7 @@ fi AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ clock confstr ctermid dup3 execv faccessat fchmod fchmodat fchown fchownat \ fexecve fdopendir fork fpathconf fstatat ftime ftruncate futimesat \ - futimens futimes gai_strerror getentropy \ + futimens futimes gai_strerror \ getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ if_nameindex \ diff -r ef9346be45d0 pyconfig.h.in --- a/pyconfig.h.in Mon Sep 07 22:51:56 2015 +0300 +++ b/pyconfig.h.in Mon Sep 07 23:54:12 2015 +0200 @@ -329,9 +329,6 @@ /* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ #undef HAVE_GETC_UNLOCKED -/* Define to 1 if you have the `getentropy' function. */ -#undef HAVE_GETENTROPY - /* Define to 1 if you have the `getgrouplist' function. */ #undef HAVE_GETGROUPLIST