diff options
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r-- | Lib/pathlib.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 1bd457a487..8fef2590b8 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -494,11 +494,14 @@ class _RecursiveWildcardSelector(_Selector): def _iterate_directories(self, parent_path, is_dir, listdir): yield parent_path - for name in listdir(parent_path): - path = parent_path._make_child_relpath(name) - if is_dir(path) and not path.is_symlink(): - for p in self._iterate_directories(path, is_dir, listdir): - yield p + try: + for name in listdir(parent_path): + path = parent_path._make_child_relpath(name) + if is_dir(path) and not path.is_symlink(): + for p in self._iterate_directories(path, is_dir, listdir): + yield p + except PermissionError: + return def _select_from(self, parent_path, is_dir, exists, listdir): try: |