diff options
author | Antoine Pitrou <pitrou@free.fr> | 2017-06-30 08:01:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-30 08:01:05 (GMT) |
commit | 729780a810bbcb12b245a1b652302a601fc9f6fd (patch) | |
tree | 98182b9933e15696fbf1dc97364f6e048c219600 /Lib/test/test_signal.py | |
parent | 42bc8beadd49f60cc52fdc397897b3bd81640406 (diff) | |
download | cpython-729780a810bbcb12b245a1b652302a601fc9f6fd.zip cpython-729780a810bbcb12b245a1b652302a601fc9f6fd.tar.gz cpython-729780a810bbcb12b245a1b652302a601fc9f6fd.tar.bz2 |
bpo-30807: signal.setitimer() may disable the timer by mistake (#2493)
* bpo-30807: signal.setitimer() may disable the timer by mistake
* Add NEWS blurb
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 0ddfe36..0e1d067 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -608,6 +608,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): """ |