File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -7523,8 +7523,10 @@ os_sched_get_priority_max_impl(PyObject *module, int policy)
7523
7523
{
7524
7524
int max ;
7525
7525
7526
+ /* make sure that errno is cleared before the call */
7527
+ errno = 0 ;
7526
7528
max = sched_get_priority_max (policy );
7527
- if (max == -1 )
7529
+ if (max == -1 && errno )
7528
7530
return posix_error ();
7529
7531
return PyLong_FromLong (max );
7530
7532
}
@@ -7542,8 +7544,12 @@ static PyObject *
7542
7544
os_sched_get_priority_min_impl (PyObject * module , int policy )
7543
7545
/*[clinic end generated code: output=7595c1138cc47a6d input=21bc8fa0d70983bf]*/
7544
7546
{
7545
- int min = sched_get_priority_min (policy );
7546
- if (min == -1 )
7547
+ int min ;
7548
+
7549
+ /* make sure that errno is cleared before the call */
7550
+ errno = 0 ;
7551
+ min = sched_get_priority_min (policy );
7552
+ if (min == -1 && errno )
7547
7553
return posix_error ();
7548
7554
return PyLong_FromLong (min );
7549
7555
}
You can’t perform that action at this time.
0 commit comments