-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-41839: Fix error checking in sched_get_priority_ functions #22374
base: main
Are you sure you want to change the base?
Conversation
If this seems too dangerous to merge to you, we can use the variant used by OmniOS instead, which is not as nice & simple, but definitely won't break existing stuff. |
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. |
Python presumes that any negative number returned from
sched_get_priority_min
orsched_get_priority_max
indicates that error has occurred. However, neither Linux manual pages nor POSIX.1-2001 specification forbids negative values to be returned; only-1
has a special meaning for error.https://bugs.python.org/issue41839