File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change
1
+ Allow negative priority values from :func: `os.sched_get_priority_min ` and
2
+ :func: `os.sched_get_priority_max ` functions.
Original file line number Diff line number Diff line change @@ -8211,10 +8211,10 @@ static PyObject *
8211
8211
os_sched_get_priority_max_impl (PyObject * module , int policy )
8212
8212
/*[clinic end generated code: output=9e465c6e43130521 input=2097b7998eca6874]*/
8213
8213
{
8214
- int max ;
8215
-
8216
- max = sched_get_priority_max (policy );
8217
- if (max < 0 )
8214
+ /* make sure that errno is cleared before the call */
8215
+ errno = 0 ;
8216
+ int max = sched_get_priority_max (policy );
8217
+ if (max == -1 && errno )
8218
8218
return posix_error ();
8219
8219
return PyLong_FromLong (max );
8220
8220
}
@@ -8232,8 +8232,10 @@ static PyObject *
8232
8232
os_sched_get_priority_min_impl (PyObject * module , int policy )
8233
8233
/*[clinic end generated code: output=7595c1138cc47a6d input=21bc8fa0d70983bf]*/
8234
8234
{
8235
+ /* make sure that errno is cleared before the call */
8236
+ errno = 0 ;
8235
8237
int min = sched_get_priority_min (policy );
8236
- if (min < 0 )
8238
+ if (min == -1 && errno )
8237
8239
return posix_error ();
8238
8240
return PyLong_FromLong (min );
8239
8241
}
You can’t perform that action at this time.
0 commit comments