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 *
82118211os_sched_get_priority_max_impl (PyObject * module , int policy )
82128212/*[clinic end generated code: output=9e465c6e43130521 input=2097b7998eca6874]*/
82138213{
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 )
82188218 return posix_error ();
82198219 return PyLong_FromLong (max );
82208220}
@@ -8232,8 +8232,10 @@ static PyObject *
82328232os_sched_get_priority_min_impl (PyObject * module , int policy )
82338233/*[clinic end generated code: output=7595c1138cc47a6d input=21bc8fa0d70983bf]*/
82348234{
8235+ /* make sure that errno is cleared before the call */
8236+ errno = 0 ;
82358237 int min = sched_get_priority_min (policy );
8236- if (min < 0 )
8238+ if (min == -1 && errno )
82378239 return posix_error ();
82388240 return PyLong_FromLong (min );
82398241}
You can’t perform that action at this time.
0 commit comments