diff options
author | Antoine Pitrou <pitrou@free.fr> | 2017-06-30 08:54:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-30 08:54:24 (GMT) |
commit | 6f3cb059fd1f3a57ffd70c9d54a394a85a6ea13d (patch) | |
tree | ee380bf0b0e1f1b4071ddb4fbbf84498f52d077c /Lib/test/test_signal.py | |
parent | 6f31717c47e325460e2a661bf44b45d342d65bcb (diff) | |
download | cpython-6f3cb059fd1f3a57ffd70c9d54a394a85a6ea13d.zip cpython-6f3cb059fd1f3a57ffd70c9d54a394a85a6ea13d.tar.gz cpython-6f3cb059fd1f3a57ffd70c9d54a394a85a6ea13d.tar.bz2 |
[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 729780a810bbcb12b245a1b652302a601fc9f6fd)
Diffstat (limited to 'Lib/test/test_signal.py')
-rw-r--r-- | Lib/test/test_signal.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index ab42ed7..aa2b8bb 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -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): """ |