From e801069023f71dd68cfd55f033faa098d2e3e233 Mon Sep 17 00:00:00 2001 From: barneygale Date: Sat, 13 Jan 2024 18:39:41 +0000 Subject: [PATCH 1/3] GH-82695: Clarify `pathlib.Path.mkdir()` documentation Remove a double negative in the documentation of `mkdir()`'s *exist_ok* parameter. --- Doc/library/pathlib.rst | 6 +++--- .../2024-01-13-18-34-39.gh-issue-82695.xNkDqE.rst | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 Misc/NEWS.d/next/Documentation/2024-01-13-18-34-39.gh-issue-82695.xNkDqE.rst diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 60791725c2323d..bf99a7a41f330e 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -1280,9 +1280,9 @@ call fails (for example because the path doesn't exist). If *exist_ok* is false (the default), :exc:`FileExistsError` is raised if the target directory already exists. - If *exist_ok* is true, :exc:`FileExistsError` exceptions will be - ignored (same behavior as the POSIX ``mkdir -p`` command), but only if the - last path component is not an existing non-directory file. + If *exist_ok* is true, :exc:`FileExistsError` is raised only if the given + path already exists in the file system and is not a directory (same + behavior as the POSIX ``mkdir -p`` command). .. versionchanged:: 3.5 The *exist_ok* parameter was added. diff --git a/Misc/NEWS.d/next/Documentation/2024-01-13-18-34-39.gh-issue-82695.xNkDqE.rst b/Misc/NEWS.d/next/Documentation/2024-01-13-18-34-39.gh-issue-82695.xNkDqE.rst new file mode 100644 index 00000000000000..971cada4949a5e --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2024-01-13-18-34-39.gh-issue-82695.xNkDqE.rst @@ -0,0 +1,2 @@ +Clarify :meth:`pathlib.Path.mkdir` documentation by removing a double +negative. From f4017ba52d6952303b65eb0fbd52edd828ee5dd0 Mon Sep 17 00:00:00 2001 From: barneygale Date: Tue, 16 Jan 2024 01:07:38 +0000 Subject: [PATCH 2/3] Delete news entry --- .../Documentation/2024-01-13-18-34-39.gh-issue-82695.xNkDqE.rst | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 Misc/NEWS.d/next/Documentation/2024-01-13-18-34-39.gh-issue-82695.xNkDqE.rst diff --git a/Misc/NEWS.d/next/Documentation/2024-01-13-18-34-39.gh-issue-82695.xNkDqE.rst b/Misc/NEWS.d/next/Documentation/2024-01-13-18-34-39.gh-issue-82695.xNkDqE.rst deleted file mode 100644 index 971cada4949a5e..00000000000000 --- a/Misc/NEWS.d/next/Documentation/2024-01-13-18-34-39.gh-issue-82695.xNkDqE.rst +++ /dev/null @@ -1,2 +0,0 @@ -Clarify :meth:`pathlib.Path.mkdir` documentation by removing a double -negative. From 9643b0284551ad779eda9ecc39f5958a6948282e Mon Sep 17 00:00:00 2001 From: Barney Gale Date: Tue, 23 Jan 2024 02:24:34 +0000 Subject: [PATCH 3/3] Update Doc/library/pathlib.rst Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Doc/library/pathlib.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index bf99a7a41f330e..e03b094e430f97 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -1280,7 +1280,7 @@ call fails (for example because the path doesn't exist). If *exist_ok* is false (the default), :exc:`FileExistsError` is raised if the target directory already exists. - If *exist_ok* is true, :exc:`FileExistsError` is raised only if the given + If *exist_ok* is true, :exc:`FileExistsError` will not be raised unless the given path already exists in the file system and is not a directory (same behavior as the POSIX ``mkdir -p`` command).