From dbaa559b7fc6b80c1f230119f609b99b5b3844f3 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sat, 30 Jul 2016 23:21:50 -0700 Subject: [PATCH] all SCHED_ constants are optional (closes #27656) --- Misc/NEWS | 2 ++ Modules/posixmodule.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Misc/NEWS b/Misc/NEWS index 6b2b41921fe..0a6ddf49c05 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -34,6 +34,8 @@ Core and Builtins Library ------- +- 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 ee600fc237e..b854cafb6f7 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -12750,9 +12750,15 @@ all_ins(PyObject *m) #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