mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #23285: PEP 475 -- Retry system calls failing with EINTR.
This commit is contained in:
parent
d005090e01
commit
6e6c59b508
18 changed files with 753 additions and 522 deletions
|
@ -188,8 +188,6 @@ def main(listener_fd, alive_r, preload, main_path=None, sys_path=None):
|
|||
finally:
|
||||
os._exit(code)
|
||||
|
||||
except InterruptedError:
|
||||
pass
|
||||
except OSError as e:
|
||||
if e.errno != errno.ECONNABORTED:
|
||||
raise
|
||||
|
@ -230,13 +228,7 @@ def read_unsigned(fd):
|
|||
data = b''
|
||||
length = UNSIGNED_STRUCT.size
|
||||
while len(data) < length:
|
||||
while True:
|
||||
try:
|
||||
s = os.read(fd, length - len(data))
|
||||
except InterruptedError:
|
||||
pass
|
||||
else:
|
||||
break
|
||||
s = os.read(fd, length - len(data))
|
||||
if not s:
|
||||
raise EOFError('unexpected EOF')
|
||||
data += s
|
||||
|
@ -245,13 +237,7 @@ def read_unsigned(fd):
|
|||
def write_unsigned(fd, n):
|
||||
msg = UNSIGNED_STRUCT.pack(n)
|
||||
while msg:
|
||||
while True:
|
||||
try:
|
||||
nbytes = os.write(fd, msg)
|
||||
except InterruptedError:
|
||||
pass
|
||||
else:
|
||||
break
|
||||
nbytes = os.write(fd, msg)
|
||||
if nbytes == 0:
|
||||
raise RuntimeError('should not get here')
|
||||
msg = msg[nbytes:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue