Mercurial > hg
diff mercurial/keepalive.py @ 49304:48f1b314056b
py3: catch BrokenPipeError instead of checking errno == EPIPE
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Tue, 31 May 2022 16:54:58 +0200 |
parents | 642e31cb55f0 |
children | 8251f7cc787d |
line wrap: on
line diff
--- a/mercurial/keepalive.py Tue May 31 04:18:22 2022 +0200 +++ b/mercurial/keepalive.py Tue May 31 16:54:58 2022 +0200 @@ -84,7 +84,6 @@ import collections -import errno import hashlib import socket import sys @@ -657,14 +656,14 @@ else: self.sock.sendall(str) self.sentbytescount += len(str) - except socket.error as v: - reraise = True - if v.args[0] == errno.EPIPE: # Broken pipe - if self._HTTPConnection__state == httplib._CS_REQ_SENT: - self._broken_pipe_resp = None - self._broken_pipe_resp = self.getresponse() - reraise = False - self.close() + except BrokenPipeError: + if self._HTTPConnection__state == httplib._CS_REQ_SENT: + self._broken_pipe_resp = None + self._broken_pipe_resp = self.getresponse() + reraise = False + else: + reraise = True + self.close() if reraise: raise