-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
gh-125997: ensure that time.sleep(0)
is not delayed on non-Windows platforms
#128274
base: main
Are you sure you want to change the base?
Conversation
ff959e1
to
80de853
Compare
@picnixz Unfortunately, we should seriously review :(. It seems that an assertion failed somewhere.
|
Ah I think I know what happens. When we raise an OSError from errno we don't clear the errno. So if you chain calls, you need to just ignore them. I'm removing the assertion cc @ZeroIntensity |
Due to how `OSError` are raised from `errno`, we do not clear `errno` afterwards. If we catch `OSError`, then we still have an errno set, and if we call `time.sleep()` just after, we may have `errno != 0` (but we know we handled it so it's fine).
If pytime is running on multiple cores, I recommend using raw defined
|
This wouldn't solve the issue (also because |
TIL! Should we assert |
Not sure. It's not really an issue and the function is internal and only for |
I think we should. There's no real cost to adding it, and it would be helpful for debugging in the rare case that something goes wrong. |
This is a suggestion for fixing the issue when the timeout is 0. For other timeouts, this does not change the current behaviour (I'm tempted removing the
do-while
loop as we should never have an issue, but I'm not familar with the monotonic C implementation so I left it as is).time.sleep(0)
regression in 3.11 onwards #125997