# HG changeset patch # User Matt Harbison # Date 1544402454 18000 # Node ID 348352658e4b0b0206e04c9bccd27a036edd5584 # Parent 44378796c5e5eec7bc3bc3881a0399c8050ec712 py3: stop subscripting socket.error In 3.3 and later, this is now an alias for OSError. I hacked up the server code enough that I was able to trigger the exception handler in server.py from test-http-bundle1.t. Other instances of this either subscript through the `args` member, or reference the errno or strerror attributes. Note that on Windows, the errno value seems to reflect the Winsock error, so the various tests for EPIPE seem like they would always fail. But that seems to be the case in py2 as well. diff -r 44378796c5e5 -r 348352658e4b mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py Sun Dec 09 16:49:55 2018 +0100 +++ b/mercurial/hgweb/server.py Sun Dec 09 19:40:54 2018 -0500 @@ -94,7 +94,7 @@ 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 -r 44378796c5e5 -r 348352658e4b mercurial/keepalive.py --- a/mercurial/keepalive.py Sun Dec 09 16:49:55 2018 +0100 +++ b/mercurial/keepalive.py Sun Dec 09 19:40:54 2018 -0500 @@ -636,7 +636,7 @@ 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()