comparison mercurial/keepalive.py @ 40874:348352658e4b

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.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 09 Dec 2018 19:40:54 -0500
parents 588f1e9a4d16
children a43acfa2b76d
comparison
equal deleted inserted replaced
40873:44378796c5e5 40874:348352658e4b
634 else: 634 else:
635 self.sock.sendall(str) 635 self.sock.sendall(str)
636 self.sentbytescount += len(str) 636 self.sentbytescount += len(str)
637 except socket.error as v: 637 except socket.error as v:
638 reraise = True 638 reraise = True
639 if v[0] == errno.EPIPE: # Broken pipe 639 if v.args[0] == errno.EPIPE: # Broken pipe
640 if self._HTTPConnection__state == httplib._CS_REQ_SENT: 640 if self._HTTPConnection__state == httplib._CS_REQ_SENT:
641 self._broken_pipe_resp = None 641 self._broken_pipe_resp = None
642 self._broken_pipe_resp = self.getresponse() 642 self._broken_pipe_resp = self.getresponse()
643 reraise = False 643 reraise = False
644 self.close() 644 self.close()