-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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-30807: signal.setitimer() may disable the timer by mistake #2493
Conversation
@pitrou, thanks for your PR! By analyzing the history of the files in this pull request, we identified @tiran, @rosslagerwall and @giampaolo to be potential reviewers. |
# Check that float -> timeval conversion doesn't round | ||
# the interval down to zero, which would disable the timer. | ||
self.itimer = signal.ITIMER_REAL | ||
signal.setitimer(self.itimer, 1e-6) |
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 suggest to test 1e-9 to make sure that it's smaller than 1 us, since 1e-6 is not an exact floating number number.
>>> (1e-6).hex()
'0x1.0c6f7a0b5ed8dp-20'
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.
You don't understand. 1e-6
is the minimum advertised resolution for setitimer
, that's why it's supposed to work.
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.
On the other hand, your suggestion would make the test fail reliably without the patch. I'm on the (signal) fence.
@@ -0,0 +1,6 @@ | |||
signal.setitimer() may disable the timer when passed a tiny value. | |||
|
|||
Tiny values (such as 1e-6) are valid non-zero values for setitimer(), which |
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.
Hum, I'm not sure about your Git-commit-message-like formatting. I may be needed to agree on a style on python-dev.
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 don't really care about this :-)
…ythonGH-2493) * bpo-30807: signal.setitimer() may disable the timer by mistake * Add NEWS blurb (cherry picked from commit 729780a)
GH-2497 is a backport of this pull request to the 3.6 branch. |
…ythonGH-2493) * bpo-30807: signal.setitimer() may disable the timer by mistake * Add NEWS blurb (cherry picked from commit 729780a)
GH-2498 is a backport of this pull request to the 3.5 branch. |
…ythonGH-2493) * bpo-30807: signal.setitimer() may disable the timer by mistake * Add NEWS blurb. (cherry picked from commit 729780a)
GH-2499 is a backport of this pull request to the 2.7 branch. |
No description provided.