Issue #28676: Prevent missing 'getentropy' declaration warning on macOS.
Initial patch by Gareth Rees.
diff --git a/Misc/NEWS b/Misc/NEWS
index 3834e38..f4c97b6 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -295,6 +295,9 @@
- Issue #27806: Fix 32-bit builds on macOS Sierra 10.12 broken by removal of
deprecated QuickTime/QuickTime.h header file. Patch by Aleks Bunin.
+- Issue #28676: Prevent missing 'getentropy' declaration warning on macOS.
+ Initial patch by Gareth Rees.
+
Tools/Demos
-----------
diff --git a/Python/random.c b/Python/random.c
index b4bc1f3..2f83b5d 100644
--- a/Python/random.c
+++ b/Python/random.c
@@ -3,6 +3,9 @@
#include <windows.h>
#else
#include <fcntl.h>
+#if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY)
+#include <sys/random.h>
+#endif
#endif
#ifdef Py_DEBUG