Skip to content

Commit 0ee681a

Browse files
authored
[3.12] GH-78988: Document pathlib.Path.glob() exception propagation. (GH-114036) (#114154)
We propagate the `OSError` from the `is_dir()` call on the top-level directory, and suppress all others. (cherry picked from commit 7092b3f)
1 parent 59da126 commit 0ee681a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Doc/library/pathlib.rst

+4
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,10 @@ call fails (for example because the path doesn't exist).
916916
PosixPath('setup.py'),
917917
PosixPath('test_pathlib.py')]
918918

919+
This method calls :meth:`Path.is_dir` on the top-level directory and
920+
propagates any :exc:`OSError` exception that is raised. Subsequent
921+
:exc:`OSError` exceptions from scanning directories are suppressed.
922+
919923
By default, or when the *case_sensitive* keyword-only argument is set to
920924
``None``, this method matches paths using platform-specific casing rules:
921925
typically, case-sensitive on POSIX, and case-insensitive on Windows.

0 commit comments

Comments
 (0)