From a798373a1c3994ab43d3a1eaf94db1811efe9197 Mon Sep 17 00:00:00 2001 From: barneygale Date: Sat, 13 Jan 2024 18:26:39 +0000 Subject: [PATCH 1/3] GH-99334: Explain that `PurePath.is_relative_to()` is purely lexical. --- Doc/library/pathlib.rst | 7 +++++++ .../2024-01-13-18-23-56.gh-issue-99334.qv6b34.rst | 1 + 2 files changed, 8 insertions(+) create mode 100644 Misc/NEWS.d/next/Documentation/2024-01-13-18-23-56.gh-issue-99334.qv6b34.rst diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 60791725c2323d..811d096aff4b79 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -528,6 +528,13 @@ Pure paths provide the following methods and properties: >>> p.is_relative_to('/usr') False + This method is string-based; it neither accesses the filesystem nor treats + "``..``" segments specially. The following code is equivalent: + + >>> u = PurePath('/usr') + >>> u == p or u in p.parents + True + .. versionadded:: 3.9 .. deprecated-removed:: 3.12 3.14 diff --git a/Misc/NEWS.d/next/Documentation/2024-01-13-18-23-56.gh-issue-99334.qv6b34.rst b/Misc/NEWS.d/next/Documentation/2024-01-13-18-23-56.gh-issue-99334.qv6b34.rst new file mode 100644 index 00000000000000..4e94f0093fd9f0 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2024-01-13-18-23-56.gh-issue-99334.qv6b34.rst @@ -0,0 +1 @@ +Explain that :meth:`PurePath.is_relative_to` is a purely lexical operation. From 0321d67456182ec9252a26e832ddaf8340297dc7 Mon Sep 17 00:00:00 2001 From: barneygale Date: Sat, 13 Jan 2024 19:18:20 +0000 Subject: [PATCH 2/3] Fix example. --- 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 811d096aff4b79..d65b03926cfa21 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -533,7 +533,7 @@ Pure paths provide the following methods and properties: >>> u = PurePath('/usr') >>> u == p or u in p.parents - True + False .. versionadded:: 3.9 From 344e4b2d3da0ee4fa0207649bd0c89fe0b26ac1e Mon Sep 17 00:00:00 2001 From: barneygale Date: Tue, 16 Jan 2024 01:08:07 +0000 Subject: [PATCH 3/3] Delete news entry --- .../Documentation/2024-01-13-18-23-56.gh-issue-99334.qv6b34.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Documentation/2024-01-13-18-23-56.gh-issue-99334.qv6b34.rst diff --git a/Misc/NEWS.d/next/Documentation/2024-01-13-18-23-56.gh-issue-99334.qv6b34.rst b/Misc/NEWS.d/next/Documentation/2024-01-13-18-23-56.gh-issue-99334.qv6b34.rst deleted file mode 100644 index 4e94f0093fd9f0..00000000000000 --- a/Misc/NEWS.d/next/Documentation/2024-01-13-18-23-56.gh-issue-99334.qv6b34.rst +++ /dev/null @@ -1 +0,0 @@ -Explain that :meth:`PurePath.is_relative_to` is a purely lexical operation.