Skip to content

Commit

Permalink
pythonGH-78988: Document pathlib.Path.glob() exception propagation.
Browse files Browse the repository at this point in the history
We propagate the `OSError` from the `is_dir()` call on the top-level
directory, and suppress all others.
  • Loading branch information
barneygale committed Jan 13, 2024
1 parent 77b45fa commit 5f6d3a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Document :meth:`pathlib.Path.glob` exception propagation.

0 comments on commit 5f6d3a0

Please sign in to comment.