]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] GH-78988: Document `pathlib.Path.glob()` exception propagation. (GH-114036...
authorBarney Gale <barney.gale@gmail.com>
Tue, 16 Jan 2024 22:39:09 +0000 (22:39 +0000)
committerGitHub <noreply@github.com>
Tue, 16 Jan 2024 22:39:09 +0000 (22:39 +0000)
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

index d8fa4a27a28a0bf6d3dda54c9c55f35cc4e43189..46a4d10b11d6024648ec4794e5d7aa6986e4574c 100644 (file)
@@ -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.