summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/connection.py
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2013-07-01 17:59:26 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2013-07-01 17:59:26 (GMT)
commitcca8c53d6aa158d3288ad462c98a1c74b24bc2dd (patch)
treed95dab979784f61f49ba23477ed92cc0722f9d32 /Lib/multiprocessing/connection.py
parent80878793494b497bf3db9c5828373ab25df6a92f (diff)
downloadcpython-cca8c53d6aa158d3288ad462c98a1c74b24bc2dd.zip
cpython-cca8c53d6aa158d3288ad462c98a1c74b24bc2dd.tar.gz
cpython-cca8c53d6aa158d3288ad462c98a1c74b24bc2dd.tar.bz2
Issue #17097: Make multiprocessing ignore EINTR.
Diffstat (limited to 'Lib/multiprocessing/connection.py')
-rw-r--r--Lib/multiprocessing/connection.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py
index df57906..2a0bc2f 100644
--- a/Lib/multiprocessing/connection.py
+++ b/Lib/multiprocessing/connection.py
@@ -366,7 +366,10 @@ class Connection(_ConnectionBase):
def _send(self, buf, write=_write):
remaining = len(buf)
while True:
- n = write(self._handle, buf)
+ try:
+ n = write(self._handle, buf)
+ except InterruptedError:
+ continue
remaining -= n
if remaining == 0:
break
@@ -377,7 +380,10 @@ class Connection(_ConnectionBase):
handle = self._handle
remaining = size
while remaining > 0:
- chunk = read(handle, remaining)
+ try:
+ chunk = read(handle, remaining)
+ except InterruptedError:
+ continue
n = len(chunk)
if n == 0:
if remaining == size:
@@ -581,7 +587,13 @@ class SocketListener(object):
self._unlink = None
def accept(self):
- s, self._last_accepted = self._socket.accept()
+ while True:
+ try:
+ s, self._last_accepted = self._socket.accept()
+ except InterruptedError:
+ pass
+ else:
+ break
s.setblocking(True)
return Connection(s.detach())