From af25c85090c8687df1779de420236d01c920dddf Mon Sep 17 00:00:00 2001 From: Barney Gale Date: Tue, 16 Jan 2024 22:28:54 +0000 Subject: [PATCH 1/2] 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. (cherry picked from commit 7092b3f1319269accf4c02f08256d51f111b9ca3) --- Doc/library/pathlib.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index d8fa4a27a28a0b..46a4d10b11d602 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -916,6 +916,10 @@ call fails (for example because the path doesn't exist). PosixPath('setup.py'), PosixPath('test_pathlib.py')] + 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. From a7cef825ddf5e62fb3875c9d8f5e7a5aeedfe7f5 Mon Sep 17 00:00:00 2001 From: barneygale Date: Tue, 16 Jan 2024 22:32:18 +0000 Subject: [PATCH 2/2] [3.12] GH-78988: Document `pathlib.Path.glob()` exception propagation. (GH-114036) We propagate the `OSError` from the `is_dir()` call on the top-level directory, and suppress all others.. (cherry picked from commit 7092b3f1319269accf4c02f08256d51f111b9ca3) Co-authored-by: Barney Gale