On illumos, scheduling priorities can be less than 0 (For example, the default range is -60 to 60 for the TS and FSS schedulers) However, -1 alongside EINVAL represents an error. diff -wpruN --no-dereference '--exclude=*.orig' a~/Modules/posixmodule.c a/Modules/posixmodule.c --- a~/Modules/posixmodule.c 1970-01-01 00:00:00 +++ a/Modules/posixmodule.c 1970-01-01 00:00:00 @@ -8104,7 +8104,11 @@ os_sched_get_priority_max_impl(PyObject int max; max = sched_get_priority_max(policy); +#ifdef __sun + if (max == -1 && errno == EINVAL) +#else if (max < 0) +#endif return posix_error(); return PyLong_FromLong(max); } @@ -8123,7 +8127,11 @@ os_sched_get_priority_min_impl(PyObject /*[clinic end generated code: output=7595c1138cc47a6d input=21bc8fa0d70983bf]*/ { int min = sched_get_priority_min(policy); +#ifdef __sun + if (min == -1 && errno == EINVAL) +#else if (min < 0) +#endif return posix_error(); return PyLong_FromLong(min); }