comparison mercurial/hg.py @ 49309:c463f45fa114

py3: stop catching TypeError that was raised on Python 2
author Manuel Jacob <me@manueljacob.de>
date Tue, 31 May 2022 03:39:42 +0200
parents 642e31cb55f0
children 53e9422a9b45
comparison
equal deleted inserted replaced
49308:227124098e14 49309:c463f45fa114
74 # because the latter started returning `False` on invalid path 74 # because the latter started returning `False` on invalid path
75 # exceptions starting in 3.8 and we care about handling 75 # exceptions starting in 3.8 and we care about handling
76 # invalid paths specially here. 76 # invalid paths specially here.
77 st = os.stat(path) 77 st = os.stat(path)
78 isfile = stat.S_ISREG(st.st_mode) 78 isfile = stat.S_ISREG(st.st_mode)
79 # Python 2 raises TypeError, Python 3 ValueError. 79 except ValueError as e:
80 except (TypeError, ValueError) as e:
81 raise error.Abort( 80 raise error.Abort(
82 _(b'invalid path %s: %s') % (path, stringutil.forcebytestr(e)) 81 _(b'invalid path %s: %s') % (path, stringutil.forcebytestr(e))
83 ) 82 )
84 except OSError: 83 except OSError:
85 isfile = False 84 isfile = False