From 5f6d3a08ead902b996e7b1b574befe79d4df8a89 Mon Sep 17 00:00:00 2001 From: barneygale Date: Sat, 13 Jan 2024 19:37:35 +0000 Subject: [PATCH 1/2] GH-78988: Document `pathlib.Path.glob()` exception propagation. We propagate the `OSError` from the `is_dir()` call on the top-level directory, and suppress all others. --- Doc/library/pathlib.rst | 4 ++++ .../2024-01-13-19-36-51.gh-issue-78988.QC-EQP.rst | 1 + 2 files changed, 5 insertions(+) create mode 100644 Misc/NEWS.d/next/Documentation/2024-01-13-19-36-51.gh-issue-78988.QC-EQP.rst diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 60791725c2323d..084d8bf4d3ca2b 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. diff --git a/Misc/NEWS.d/next/Documentation/2024-01-13-19-36-51.gh-issue-78988.QC-EQP.rst b/Misc/NEWS.d/next/Documentation/2024-01-13-19-36-51.gh-issue-78988.QC-EQP.rst new file mode 100644 index 00000000000000..ab34a29c2523e7 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2024-01-13-19-36-51.gh-issue-78988.QC-EQP.rst @@ -0,0 +1 @@ +Document :meth:`pathlib.Path.glob` exception propagation. From 2c2aed5551501b28e7fe6a656ad74516f727ec15 Mon Sep 17 00:00:00 2001 From: barneygale Date: Tue, 16 Jan 2024 01:05:57 +0000 Subject: [PATCH 2/2] Delete news entry --- .../Documentation/2024-01-13-19-36-51.gh-issue-78988.QC-EQP.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Documentation/2024-01-13-19-36-51.gh-issue-78988.QC-EQP.rst diff --git a/Misc/NEWS.d/next/Documentation/2024-01-13-19-36-51.gh-issue-78988.QC-EQP.rst b/Misc/NEWS.d/next/Documentation/2024-01-13-19-36-51.gh-issue-78988.QC-EQP.rst deleted file mode 100644 index ab34a29c2523e7..00000000000000 --- a/Misc/NEWS.d/next/Documentation/2024-01-13-19-36-51.gh-issue-78988.QC-EQP.rst +++ /dev/null @@ -1 +0,0 @@ -Document :meth:`pathlib.Path.glob` exception propagation.