8000 gh-125997: ensure that `time.sleep(0)` is not delayed on non-Windows platforms by picnixz · Pull Request #128274 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-125997: ensure that time.sleep(0) is not delayed on non-Windows platforms #128274

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

Closed
wants to merge 26 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removing assert(errno == 0)
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).
  • Loading branch information
picnixz committed Dec 27, 2024
commit c7aa42826c4bd45ee156d29d06ef47b857d8e92c
2 changes: 0 additions & 2 deletions Modules/timemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2217,7 +2217,6 @@ pysleep(PyTime_t timeout)
{
assert(timeout >= 0);
#ifndef MS_WINDOWS
assert(errno == 0);
if (timeout == 0) {
return pysleep_zero_posix();
}
Expand Down Expand Up @@ -2408,7 +2407,6 @@ pysleep(PyTime_t timeout)
static int
pysleep_zero_posix(void)
{
assert(errno == 0);
PyTime_t deadline, monotonic;
if (PyTime_Monotonic(&monotonic) < 0) {
return -1;
Expand Down
Loading
0