bpo-41839: Fix error checking in sched_get_priority_ functions#22374
bpo-41839: Fix error checking in sched_get_priority_ functions#22374serhiy-storchaka merged 8 commits intopython:mainfrom
Conversation
|
If this seems too dangerous to merge, we can use the variant used by OmniOS instead, which makes the change Solaris specific. |
|
Is it guaranteed that a successul syscall clears errno? Because if yes, then the |
|
It is not guaranteed, and this simple case confirms that it is not being cleared: but we can still do it ourselves. You are right that -1 is still a legitimate priority, and although I don't think it even happens in any Solaris (historically, some schedulers used -60 and 60, the newer ones are using positive values only), it is not impossible (and also, I might be wrong :)). I updated the code, now it should always work on systems where |
fe9ee56 to
d1a27a6
Compare
5b7ab02 to
4d818a2
Compare
4d818a2 to
f55a532
Compare
|
What needs to be done to see this PR merged? The change is obviously improving compatibility with POSIX and there is not known any regression. Thank you. |
Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
|
Thanks @kulikjak for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…nGH-22374) (cherry picked from commit bbcb75c) Co-authored-by: Jakub Kulík <[email protected]>
|
GH-138201 is a backport of this pull request to the 3.14 branch. |
…nGH-22374) (cherry picked from commit bbcb75c) Co-authored-by: Jakub Kulík <[email protected]>
|
GH-138202 is a backport of this pull request to the 3.13 branch. |
…GH-22374) (GH-138202) (cherry picked from commit bbcb75c) Co-authored-by: Jakub Kulík <[email protected]>
…GH-22374) (GH-138201) (cherry picked from commit bbcb75c) Co-authored-by: Jakub Kulík <[email protected]>
Python presumes that any negative number returned from
sched_get_priority_minorsched_get_priority_maxindicates that error has occurred. However, neither Linux manual pages nor POSIX.1-2001 specification forbids negative values to be returned; only-1has a special meaning for error.https://bugs.python.org/issue41839