mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +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
|
|
@ -365,10 +365,7 @@ class Connection(_ConnectionBase):
|
|||
def _send(self, buf, write=_write):
|
||||
remaining = len(buf)
|
||||
while True:
|
||||
try:
|
||||
n = write(self._handle, buf)
|
||||
except InterruptedError:
|
||||
continue
|
||||
n = write(self._handle, buf)
|
||||
remaining -= n
|
||||
if remaining == 0:
|
||||
break
|
||||
|
|
@ -379,10 +376,7 @@ class Connection(_ConnectionBase):
|
|||
handle = self._handle
|
||||
remaining = size
|
||||
while remaining > 0:
|
||||
try:
|
||||
chunk = read(handle, remaining)
|
||||
except InterruptedError:
|
||||
continue
|
||||
chunk = read(handle, remaining)
|
||||
n = len(chunk)
|
||||
if n == 0:
|
||||
if remaining == size:
|
||||
|
|
@ -595,13 +589,7 @@ class SocketListener(object):
|
|||
self._unlink = None
|
||||
|
||||
def accept(self):
|
||||
while True:
|
||||
try:
|
||||
s, self._last_accepted = self._socket.accept()
|
||||
except InterruptedError:
|
||||
pass
|
||||
else:
|
||||
break
|
||||
s, self._last_accepted = self._socket.accept()
|
||||
s.setblocking(True)
|
||||
return Connection(s.detach())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue