comparison mercurial/url.py @ 25660:328739ea70c3

global: mass rewrite to use modern exception syntax Python 2.6 introduced the "except type as instance" syntax, replacing the "except type, instance" syntax that came before. Python 3 dropped support for the latter syntax. Since we no longer support Python 2.4 or 2.5, we have no need to continue supporting the "except type, instance". This patch mass rewrites the exception syntax to be Python 2.6+ and Python 3 compatible. This patch was produced by running `2to3 -f except -w -n .`.
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 23 Jun 2015 22:20:08 -0700
parents 9d1c61715939
children d343806dcf68
comparison
equal deleted inserted replaced
25659:d60678a567a9 25660:328739ea70c3
157 if source_address: 157 if source_address:
158 sock.bind(source_address) 158 sock.bind(source_address)
159 sock.connect(sa) 159 sock.connect(sa)
160 return sock 160 return sock
161 161
162 except socket.error, msg: 162 except socket.error as msg:
163 if sock is not None: 163 if sock is not None:
164 sock.close() 164 sock.close()
165 165
166 raise socket.error(msg) 166 raise socket.error(msg)
167 167
409 # it doesn't know about the auth type requested. This can happen if 409 # it doesn't know about the auth type requested. This can happen if
410 # somebody is using BasicAuth and types a bad password. 410 # somebody is using BasicAuth and types a bad password.
411 try: 411 try:
412 return urllib2.HTTPDigestAuthHandler.http_error_auth_reqed( 412 return urllib2.HTTPDigestAuthHandler.http_error_auth_reqed(
413 self, auth_header, host, req, headers) 413 self, auth_header, host, req, headers)
414 except ValueError, inst: 414 except ValueError as inst:
415 arg = inst.args[0] 415 arg = inst.args[0]
416 if arg.startswith("AbstractDigestAuthHandler doesn't know "): 416 if arg.startswith("AbstractDigestAuthHandler doesn't know "):
417 return 417 return
418 raise 418 raise
419 419