merge heads
diff --git a/Misc/NEWS b/Misc/NEWS
index efe9b28..ffd6471 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -38,6 +38,8 @@
   HTTP_PROXY variable when REQUEST_METHOD environment is set, which indicates
   that the script is in CGI mode.
 
+- Issue #27656: Do not assume sched.h defines any SCHED_* constants.
+
 - Issue #27130: In the "zlib" module, fix handling of large buffers
   (typically 4 GiB) when compressing and decompressing.  Previously, inputs
   were limited to 4 GiB, and compression and decompression operations did not
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index ee600fc..b854caf 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -12750,9 +12750,15 @@
 #endif
 
 #ifdef HAVE_SCHED_H
+#ifdef SCHED_OTHER
     if (PyModule_AddIntMacro(m, SCHED_OTHER)) return -1;
+#endif
+#ifdef SCHED_FIFO
     if (PyModule_AddIntMacro(m, SCHED_FIFO)) return -1;
+#endif
+#ifdef SCHED_RR
     if (PyModule_AddIntMacro(m, SCHED_RR)) return -1;
+#endif
 #ifdef SCHED_SPORADIC
     if (PyModule_AddIntMacro(m, SCHED_SPORADIC) return -1;
 #endif