diff options
author | Richard Oudkerk <shibturn@gmail.com> | 2013-07-01 18:10:39 (GMT) |
---|---|---|
committer | Richard Oudkerk <shibturn@gmail.com> | 2013-07-01 18:10:39 (GMT) |
commit | 626032ac54ab2d6a779e10fdfd6eea06e43cbcc7 (patch) | |
tree | 8c931017578e57ccbd039e2355d4b81654637cf0 /Lib/multiprocessing | |
parent | 7c1457bed24f06cf793fee4536301540b5d327d4 (diff) | |
parent | cca8c53d6aa158d3288ad462c98a1c74b24bc2dd (diff) | |
download | cpython-626032ac54ab2d6a779e10fdfd6eea06e43cbcc7.zip cpython-626032ac54ab2d6a779e10fdfd6eea06e43cbcc7.tar.gz cpython-626032ac54ab2d6a779e10fdfd6eea06e43cbcc7.tar.bz2 |
Issue #17097: Merge.
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r-- | Lib/multiprocessing/connection.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py index 40f7a9e..55f6ba9 100644 --- a/Lib/multiprocessing/connection.py +++ b/Lib/multiprocessing/connection.py @@ -363,7 +363,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 @@ -374,7 +377,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: @@ -578,7 +584,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()) |