Skip to content

Conversation

@pablogsal
Copy link
Member

@pablogsal pablogsal commented Oct 17, 2017

Following @Haypo and @serhiy-storchaka instructions in #4003 (https://bugs.python.org/issue31786) time_sleep, lock_acquire_parse_args and socket_parse_timeout should use _PyTime_ROUND_TIMEOUT instead of _PyTime_ROUND_CEILING.

https://bugs.python.org/issue31806

Copy link
Member

@vstinner vstinner left a 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
Copy link
Member

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()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in d96585e

@serhiy-storchaka
Copy link
Member

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).

@miss-islington
Copy link
Contributor

Thanks @pablogsal for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-4030 is a backport of this pull request to the 3.6 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 18, 2017
…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)
@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error needs backport to 3.6 labels Oct 18, 2017
@miss-islington
Copy link
Contributor

Thanks @pablogsal for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-4032 is a backport of this pull request to the 3.6 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 18, 2017
…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)
serhiy-storchaka pushed a commit that referenced this pull request Oct 18, 2017
…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)
@pablogsal pablogsal deleted the functions_with_timeout branch November 5, 2017 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants