jenkins-core-weekly: update to 2.491
[oi-userland.git] / components / python / python39 / patches / 21-sched_get_priority.patch
blobc36ff6ec8630154e6ccc6fde29ef4c42dd8ad3b9
1 https://github.com/python/cpython/pull/22374
3 From b415ba00a73229ad102d590226decea014be11cc Mon Sep 17 00:00:00 2001
4 From: Jakub Kulik <kulikjak@gmail.com>
5 Date: Fri, 6 Nov 2020 14:58:33 +0100
6 Subject: [PATCH 4/4] Make the error checking more robust
8 ---
9 Modules/posixmodule.c | 12 +++++++++---
10 1 file changed, 9 insertions(+), 3 deletions(-)
12 diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
13 index 82edeb39022b4..f8651d7f02bb4 100644
14 --- a/Modules/posixmodule.c
15 +++ b/Modules/posixmodule.c
16 @@ -6347,8 +6347,10 @@ os_sched_get_priority_max_impl(PyObject *module, int policy)
18 int max;
20 + /* make sure that errno is cleared before the call */
21 + errno = 0;
22 max = sched_get_priority_max(policy);
23 - if (max < 0)
24 + if (max == -1 && errno == EINVAL)
25 return posix_error();
26 return PyLong_FromLong(max);
28 @@ -6366,8 +6368,12 @@ static PyObject *
29 os_sched_get_priority_min_impl(PyObject *module, int policy)
30 /*[clinic end generated code: output=7595c1138cc47a6d input=21bc8fa0d70983bf]*/
32 - int min = sched_get_priority_min(policy);
33 - if (min < 0)
34 + int min;
36 + /* make sure that errno is cleared before the call */
37 + errno = 0;
38 + min = sched_get_priority_min(policy);
39 + if (min == -1 && errno == EINVAL)
40 return posix_error();
41 return PyLong_FromLong(min);