[3.13] bpo-41839: Fix error checking in sched_get_priority_ functions (GH-22374) (GH-138202)
Some checks are pending
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if the ABI has changed (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Android (aarch64) (push) Blocked by required conditions
Tests / Android (x86_64) (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run

(cherry picked from commit bbcb75c986)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-08-27 20:05:36 +02:00 committed by GitHub
parent d6a346055b
commit 502ca0d1ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 5 deletions

View file

@ -0,0 +1,2 @@
Allow negative priority values from :func:`os.sched_get_priority_min` and
:func:`os.sched_get_priority_max` functions.

View file

@ -8101,10 +8101,10 @@ static PyObject *
os_sched_get_priority_max_impl(PyObject *module, int policy)
/*[clinic end generated code: output=9e465c6e43130521 input=2097b7998eca6874]*/
{
int max;
max = sched_get_priority_max(policy);
if (max < 0)
/* make sure that errno is cleared before the call */
errno = 0;
int max = sched_get_priority_max(policy);
if (max == -1 && errno)
return posix_error();
return PyLong_FromLong(max);
}
@ -8122,8 +8122,10 @@ static PyObject *
os_sched_get_priority_min_impl(PyObject *module, int policy)
/*[clinic end generated code: output=7595c1138cc47a6d input=21bc8fa0d70983bf]*/
{
/* make sure that errno is cleared before the call */
errno = 0;
int min = sched_get_priority_min(policy);
if (min < 0)
if (min == -1 && errno)
return posix_error();
return PyLong_FromLong(min);
}