Skip to content
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

Merged
merged 2 commits into from
Jun 30, 2017

Conversation

pitrou
Copy link
Member

@pitrou pitrou commented Jun 29, 2017

No description provided.

@mention-bot
Copy link

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

@pitrou pitrou added needs backport to 2.7 type-bug An unexpected behavior, bug, or error labels Jun 29, 2017
@pitrou pitrou requested a review from vstinner June 29, 2017 20:02
# 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)
Copy link
Member

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'

Copy link
Member Author

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.

Copy link
Member Author

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
Copy link
Member

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.

Copy link
Member Author

@pitrou pitrou Jun 29, 2017

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

@pitrou pitrou merged commit 729780a into python:master Jun 30, 2017
@pitrou pitrou deleted the setitimer_round_to_zero branch June 30, 2017 08:01
pitrou added a commit to pitrou/cpython that referenced this pull request Jun 30, 2017
…ythonGH-2493)

* bpo-30807: signal.setitimer() may disable the timer by mistake

* Add NEWS blurb
(cherry picked from commit 729780a)
@bedevere-bot
Copy link

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

pitrou added a commit to pitrou/cpython that referenced this pull request Jun 30, 2017
…ythonGH-2493)

* bpo-30807: signal.setitimer() may disable the timer by mistake

* Add NEWS blurb
(cherry picked from commit 729780a)
@bedevere-bot
Copy link

GH-2498 is a backport of this pull request to the 3.5 branch.

pitrou added a commit to pitrou/cpython that referenced this pull request Jun 30, 2017
…ythonGH-2493)

* bpo-30807: signal.setitimer() may disable the timer by mistake

* Add NEWS blurb.
(cherry picked from commit 729780a)
@bedevere-bot
Copy link

GH-2499 is a backport of this pull request to the 2.7 branch.

pitrou added a commit that referenced this pull request Jun 30, 2017
…H-2493) (#2497)

* bpo-30807: signal.setitimer() may disable the timer by mistake

* Add NEWS blurb
(cherry picked from commit 729780a)
pitrou added a commit that referenced this pull request Jun 30, 2017
…H-2493) (#2498)

* bpo-30807: signal.setitimer() may disable the timer by mistake

* Add NEWS blurb
(cherry picked from commit 729780a)
pitrou added a commit that referenced this pull request Jun 30, 2017
…H-2493) (#2499)

* bpo-30807: signal.setitimer() may disable the timer by mistake

* Add NEWS blurb.
(cherry picked from commit 729780a)
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.

5 participants