diff options
author | Rotuna <sadhanasrinivasan@protonmail.com> | 2020-05-25 19:42:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-25 19:42:28 (GMT) |
commit | 448325369ff73011d34d6c3a493014fe3ead8843 (patch) | |
tree | 7e29a28818767b44b71ce0b7cac31a3317e68e48 /Lib/pathlib.py | |
parent | 2377a9bae3f698efaa81ff0426d0feb14c9f6329 (diff) | |
download | cpython-448325369ff73011d34d6c3a493014fe3ead8843.zip cpython-448325369ff73011d34d6c3a493014fe3ead8843.tar.gz cpython-448325369ff73011d34d6c3a493014fe3ead8843.tar.bz2 |
bpo-23082: Better error message for PurePath.relative_to() from pathlib (GH-19611)
Co-authored-by: Sadhana Srinivasan <rotuna@Sadhanas-MBP.fritz.box>
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r-- | Lib/pathlib.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py index f98d69e..9f5e27b 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -922,7 +922,8 @@ class PurePath(object): cf = self._flavour.casefold_parts if (root or drv) if n == 0 else cf(abs_parts[:n]) != cf(to_abs_parts): formatted = self._format_parsed_parts(to_drv, to_root, to_parts) - raise ValueError("{!r} does not start with {!r}" + raise ValueError("{!r} is not in the subpath of {!r}" + " OR one path is relative and the other is absolute." .format(str(self), str(formatted))) return self._from_parsed_parts('', root if n == 1 else '', abs_parts[n:]) |