mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
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.
This commit is contained in:
parent
3f5d48bead
commit
f70e1ca0fc
9 changed files with 85 additions and 31 deletions
|
@ -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__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue