]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] GH-99334: Explain that `PurePath.is_relative_to()` is purely lexical. (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 23 Jan 2024 01:12:59 +0000 (02:12 +0100)
committerGitHub <noreply@github.com>
Tue, 23 Jan 2024 01:12:59 +0000 (01:12 +0000)
(cherry picked from commit 3a61d24062aaa1e13ba794360b6c765d9a1f2b06)

Doc/library/pathlib.rst

index 46a4d10b11d6024648ec4794e5d7aa6986e4574c..701131b5b2ec46300c20c3217a8accbb3393516e 100644 (file)
@@ -509,6 +509,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
+      False
+
    .. versionadded:: 3.9
 
    .. deprecated-removed:: 3.12 3.14