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 @@ -7794,8 +7794,10 @@ os_sched_get_priority_max_impl(PyObject *module, int policy)
7794
7794
{
7795
7795
int max ;
7796
7796
7797
+ /* make sure that errno is cleared before the call */
7798
+ errno = 0 ;
7797
7799
max = sched_get_priority_max (policy );
7798
- if (max == -1 )
7800
+ if (max == -1 && errno )
7799
7801
return posix_error ();
7800
7802
return PyLong_FromLong (max );
7801
7803
}
@@ -7813,8 +7815,12 @@ static PyObject *
7813
7815
os_sched_get_priority_min_impl (PyObject * module , int policy )
7814
7816
/*[clinic end generated code: output=7595c1138cc47a6d input=21bc8fa0d70983bf]*/
7815
7817
{
7816
- int min = sched_get_priority_min (policy );
7817
- if (min == -1 )
7818
+ int min ;
7819
+
7820
+ /* make sure that errno is cleared before the call */
7821
+ errno = 0 ;
7822
+ min = sched_get_priority_min (policy );
7823
+ if (min == -1 && errno )
7818
7824
return posix_error ();
7819
7825
return PyLong_FromLong (min );
7820
7826
}
You can’t perform that action at this time.
0 commit comments