only add sched_param if it is initialized
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 918ffb6..e6d70d3 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -10965,8 +10965,11 @@
     Py_INCREF((PyObject*) &StatVFSResultType);
     PyModule_AddObject(m, "statvfs_result",
                        (PyObject*) &StatVFSResultType);
+
+#if defined(HAVE_SCHED_SETPARAM) || defined(HAVE_SCHED_SETSCHEDULER)
     Py_INCREF(&SchedParamType);
     PyModule_AddObject(m, "sched_param", (PyObject *)&SchedParamType);
+#endif
     initialized = 1;
 
 #ifdef __APPLE__