diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py +++ b/mercurial/hgweb/server.py @@ -94,7 +94,7 @@ class _httprequesthandler(httpservermod. try: self.do_hgweb() except socket.error as inst: - if inst[0] != errno.EPIPE: + if inst.errno != errno.EPIPE: raise def do_POST(self): diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py --- a/mercurial/keepalive.py +++ b/mercurial/keepalive.py @@ -636,7 +636,7 @@ def safesend(self, str): self.sentbytescount += len(str) except socket.error as v: reraise = True - if v[0] == errno.EPIPE: # Broken pipe + 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()