[3.6] bpo-30807: signal.setitimer() may disable the timer by mistake (GH-2493) (#2497)

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

* Add NEWS blurb
(cherry picked from commit 729780a810)
This commit is contained in:
Antoine Pitrou 2017-06-30 10:54:24 +02:00 committed by GitHub
parent 6f31717c47
commit 6f3cb059fd
3 changed files with 19 additions and 0 deletions

View file

@ -611,6 +611,15 @@ class ItimerTest(unittest.TestCase):
# and the handler should have been called
self.assertEqual(self.hndl_called, True)
def test_setitimer_tiny(self):
# bpo-30807: C setitimer() takes a microsecond-resolution interval.
# 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)
time.sleep(1)
self.assertEqual(self.hndl_called, True)
class PendingSignalsTests(unittest.TestCase):
"""