diff -r d60678a567a9 -r 328739ea70c3 mercurial/posix.py --- a/mercurial/posix.py Tue Jun 23 22:38:21 2015 -0700 +++ b/mercurial/posix.py Tue Jun 23 22:20:08 2015 -0700 @@ -115,7 +115,7 @@ using umask.''' try: st_mode = os.lstat(src).st_mode & 0o777 - except OSError, inst: + except OSError as inst: if inst.errno != errno.ENOENT: raise st_mode = mode @@ -166,7 +166,7 @@ fd.close() except AttributeError: return False - except OSError, inst: + except OSError as inst: # sshfs might report failure while successfully creating the link if inst[0] == errno.EIO and os.path.exists(name): os.unlink(name) @@ -355,7 +355,7 @@ try: os.kill(pid, 0) return True - except OSError, inst: + except OSError as inst: return inst.errno != errno.ESRCH def explainexit(code): @@ -410,7 +410,7 @@ st = lstat(nf) if getkind(st.st_mode) not in _wantedkinds: st = None - except OSError, err: + except OSError as err: if err.errno not in (errno.ENOENT, errno.ENOTDIR): raise st = None @@ -477,7 +477,7 @@ pass except ValueError: pass - except IOError, e: + except IOError as e: if e[0] == errno.EINVAL: pass else: @@ -493,7 +493,7 @@ """unlink and remove the directory if it is empty""" try: os.unlink(f) - except OSError, e: + except OSError as e: if not (ignoremissing and e.errno == errno.ENOENT): raise # try removing directories that might now be empty @@ -560,7 +560,7 @@ os.unlink(self.path) try: self.bind(self.realpath) - except socket.error, err: + except socket.error as err: if err.args[0] == 'AF_UNIX path too long': tmpdir = tempfile.mkdtemp(prefix='hg-%s-' % subsystem) self.realpath = os.path.join(tmpdir, sockname) @@ -578,7 +578,7 @@ def okayifmissing(f, path): try: f(path) - except OSError, err: + except OSError as err: if err.errno != errno.ENOENT: raise