From 7092b3f1319269accf4c02f08256d51f111b9ca3 Mon Sep 17 00:00:00 2001 From: Barney Gale Date: Tue, 16 Jan 2024 22:28:54 +0000 Subject: GH-78988: Document `pathlib.Path.glob()` exception propagation. (#114036) We propagate the `OSError` from the `is_dir()` call on the top-level directory, and suppress all others. --- Doc/library/pathlib.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 6079172..084d8bf 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -993,6 +993,10 @@ call fails (for example because the path doesn't exist). Set *follow_symlinks* to ``True`` or ``False`` to improve performance of recursive globbing. + This method calls :meth:`Path.is_dir` on the top-level directory and + propagates any :exc:`OSError` exception that is raised. Subsequent + :exc:`OSError` exceptions from scanning directories are suppressed. + By default, or when the *case_sensitive* keyword-only argument is set to ``None``, this method matches paths using platform-specific casing rules: typically, case-sensitive on POSIX, and case-insensitive on Windows. -- cgit v0.12