mercurial/windows.py
changeset 49311 defc369d705e
parent 49305 53e9422a9b45
child 49317 709e5f7eec1f
--- a/mercurial/windows.py	Wed Jun 01 00:47:25 2022 +0200
+++ b/mercurial/windows.py	Wed Jun 01 02:21:41 2022 +0200
@@ -576,11 +576,7 @@
                     for n, k, s in listdir(dir, True)
                     if getkind(s.st_mode) in _wantedkinds
                 }
-            except OSError as err:
-                # Python >= 2.5 returns ENOENT and adds winerror field
-                # EINVAL is raised if dir is not a directory.
-                if err.errno not in (errno.ENOENT, errno.EINVAL, errno.ENOTDIR):
-                    raise
+            except (FileNotFoundError, NotADirectoryError):
                 dmap = {}
             cache = dircache.setdefault(dir, dmap)
         yield cache.get(base, None)