-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
bpo-31806: Use _PyTime_ROUND_TIMEOUT in _threadmodule.c, timemodule.c and socketmodule.c #4026
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-31806: Use _PyTime_ROUND_TIMEOUT in _threadmodule.c, timemodule.c and socketmodule.c #4026
Conversation
vstinner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still see a large number of _PyTime_ROUND_CEILING in the code. IMHO all _PyTime_ROUND_CEILING should be replaced with _PyTime_ROUND_TIMEOUT.
But maybe it's better to have this PR unchanged limited to bugfixes, and create a new PR to convert remaining _PyTime_ROUND_CEILING.
What do you think @serhiy-storchaka?
| @@ -0,0 +1,4 @@ | |||
| Fix timeout rounding in time_sleep, lock_acquire_parse_args and | |||
| socket_parse_timeout to round correctly negative timeouts between -1.0 and | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the Python names, not the internal C names:
time.sleep(), threading.Lock.acquire(), socket.socket.settimeout()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in d96585e
|
I think that replacing all _PyTime_ROUND_CEILING with _PyTime_ROUND_TIMEOUT is not necessary until we get rid of _PyTime_ROUND_CEILING at all. This is a cosmetic change and I prefer to do it in separate PR (if do). |
|
Thanks @pablogsal for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6. |
|
GH-4030 is a backport of this pull request to the 3.6 branch. |
…arsing in more functions (pythonGH-4026) Fix timeout rounding in time.sleep(), threading.Lock.acquire() and socket.socket.settimeout() to round correctly negative timeouts between -1.0 and 0.0. The functions now block waiting for events as expected. Previously, the call was incorrectly non-blocking. (cherry picked from commit 59af94f)
|
Thanks @pablogsal for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6. |
|
GH-4032 is a backport of this pull request to the 3.6 branch. |
…arsing in more functions (pythonGH-4026) Fix timeout rounding in time.sleep(), threading.Lock.acquire() and socket.socket.settimeout() to round correctly negative timeouts between -1.0 and 0.0. The functions now block waiting for events as expected. Previously, the call was incorrectly non-blocking. (cherry picked from commit 59af94f)
…arsing in more functions (GH-4026) (#4032) Fix timeout rounding in time.sleep(), threading.Lock.acquire() and socket.socket.settimeout() to round correctly negative timeouts between -1.0 and 0.0. The functions now block waiting for events as expected. Previously, the call was incorrectly non-blocking. (cherry picked from commit 59af94f)
Following @Haypo and @serhiy-storchaka instructions in #4003 (https://bugs.python.org/issue31786)
time_sleep,lock_acquire_parse_argsandsocket_parse_timeoutshould use_PyTime_ROUND_TIMEOUTinstead of_PyTime_ROUND_CEILING.https://bugs.python.org/issue31806