summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAntoine Pitrou <pitrou@free.fr>2017-06-30 08:54:32 (GMT)
committerGitHub <noreply@github.com>2017-06-30 08:54:32 (GMT)
commit5741b70acf88846a0d3b2d348535f250577b2df6 (patch)
treecbe2ec6696c8984fc9e0523cf80627bbbc33474a /Lib/test
parenta9705b777859f555d50eb5dcd5fc4260c42a0188 (diff)
downloadcpython-5741b70acf88846a0d3b2d348535f250577b2df6.zip
cpython-5741b70acf88846a0d3b2d348535f250577b2df6.tar.gz
cpython-5741b70acf88846a0d3b2d348535f250577b2df6.tar.bz2
[3.5] bpo-30807: signal.setitimer() may disable the timer by mistake (GH-2493) (#2498)
* bpo-30807: signal.setitimer() may disable the timer by mistake * Add NEWS blurb (cherry picked from commit 729780a810bbcb12b245a1b652302a601fc9f6fd)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_signal.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index 1b80ff0..5c7b31d 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -764,6 +764,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):
"""