Mercurial > hg
diff mercurial/posix.py @ 49310:050dc8730858
py3: catch specific OSError subclasses instead of checking errno
Contrary to the previous changesets in this series, this covers cases where
errno was checked for multiple values.
EACCES -> PermissionError
ENOENT -> FileNotFoundError
ENOTDIR -> NotADirectoryError
EISDIR -> IsADirectoryError
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Wed, 01 Jun 2022 00:47:25 +0200 |
parents | 6f2a57ba2d13 |
children | a9faacdc5943 |
line wrap: on
line diff
--- a/mercurial/posix.py Tue May 31 23:45:33 2022 +0200 +++ b/mercurial/posix.py Wed Jun 01 00:47:25 2022 +0200 @@ -581,9 +581,7 @@ st = lstat(nf) if getkind(st.st_mode) not in _wantedkinds: st = None - except OSError as err: - if err.errno not in (errno.ENOENT, errno.ENOTDIR): - raise + except (FileNotFoundError, NotADirectoryError): st = None yield st