summaryrefslogtreecommitdiffstats
path: root/Lib/test/eintrdata
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-03-30 19:16:11 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-03-30 19:16:11 (GMT)
commitf70e1ca0fc30426d12aa8fc6684764ee11a66777 (patch)
treeadde4b05e331c51ea39f603aff8171ca1527cef6 /Lib/test/eintrdata
parent3f5d48bead8e937aef6f94a3211406270c1a5f8f (diff)
downloadcpython-f70e1ca0fc30426d12aa8fc6684764ee11a66777.zip
cpython-f70e1ca0fc30426d12aa8fc6684764ee11a66777.tar.gz
cpython-f70e1ca0fc30426d12aa8fc6684764ee11a66777.tar.bz2
Issue #23485: select.select() is now retried automatically with the recomputed
timeout when interrupted by a signal, except if the signal handler raises an exception. This change is part of the PEP 475. The asyncore and selectors module doesn't catch the InterruptedError exception anymore when calling select.select(), since this function should not raise InterruptedError anymore.
Diffstat (limited to 'Lib/test/eintrdata')
-rw-r--r--Lib/test/eintrdata/eintr_tester.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py
index ba056fb..82cef83 100644
--- a/Lib/test/eintrdata/eintr_tester.py
+++ b/Lib/test/eintrdata/eintr_tester.py
@@ -10,6 +10,7 @@ sub-second periodicity (contrarily to signal()).
import io
import os
+import select
import signal
import socket
import time
@@ -303,12 +304,25 @@ class SignalEINTRTest(EINTRBaseTest):
self.assertGreaterEqual(dt, self.sleep_time)
+@unittest.skipUnless(hasattr(signal, "setitimer"), "requires setitimer()")
+class SelectEINTRTest(EINTRBaseTest):
+ """ EINTR tests for the select module. """
+
+ def test_select(self):
+ t0 = time.monotonic()
+ select.select([], [], [], self.sleep_time)
+ signal.alarm(0)
+ dt = time.monotonic() - t0
+ self.assertGreaterEqual(dt, self.sleep_time)
+
+
def test_main():
support.run_unittest(
OSEINTRTest,
SocketEINTRTest,
TimeEINTRTest,
- SignalEINTRTest)
+ SignalEINTRTest,
+ SelectEINTRTest)
if __name__ == "__main__":