From 4cf8a4d638788f1410e429978c30bbdd8e963a00 Mon Sep 17 00:00:00 2001 From: barneygale Date: Sun, 1 Sep 2024 16:55:33 +0100 Subject: [PATCH] Address some review feedback --- Lib/glob.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/glob.py b/Lib/glob.py index f9e2a04a6a1ece..06a29909d85148 100644 --- a/Lib/glob.py +++ b/Lib/glob.py @@ -393,7 +393,10 @@ def select_recursive(path, dir_fd=None, rel_path=None, exists=False): while stack: path, dir_fd, rel_path = stack.pop() if path is None: - self.close(dir_fd) + try: + self.close(dir_fd) + except OSError: + pass def select_recursive_step(stack, match_pos): path, dir_fd, rel_path = stack.pop() @@ -440,7 +443,8 @@ def select_recursive_step(stack, match_pos): return select_recursive def select_exists(self, path, dir_fd=None, rel_path=None, exists=False): - """Yields the given path, if it exists. + """Yields the given path, if it exists. If *dir_fd* is given, we check + whether *rel_path* exists relative to the fd. """ if exists: # Optimization: this path is already known to exist, e.g. because