mirror of
https://github.com/python/cpython.git
synced 2025-10-04 22:20:46 +00:00
[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:
parent
6f31717c47
commit
6f3cb059fd
3 changed files with 19 additions and 0 deletions
|
@ -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):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue