gh-84538: add strict argument to pathlib.PurePath.relative_to by domragusa · Pull Request #19813 · python/cpython
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
domragusa
changed the title
bpo-40358: add strict param to pathlib.PurePath.relative_to
bpo-40358: add strict argument to pathlib.PurePath.relative_to
| .. versionadded:: 3.11 | ||
| The *strict* argument (pre-3.11 behavior is strict). | ||
| .. versionadded:: 3.10 | ||
| The *strict* argument (pre-3.10 behavior is strict). |
|
|
||
| NOTE: This function is part of :class:`PurePath` and works with strings. It does not check or access the underlying file structure. | ||
| If the path doesn't start with *other* and *strict* is ``True``, :exc:`ValueError` is raised. If *strict* is ``False`` and one path is relative and the other is absolute or if they reference different drives :exc:`ValueError` is raised. |
| .. versionadded:: 3.11 | ||
| The *strict* argument (pre-3.11 behavior is strict). | ||
| .. versionadded:: 3.10 | ||
| The *strict* argument (pre-3.10 behavior is strict). |
| When *walk_up* is False, the default, the path must start with *other*, | ||
| when it's True ``..`` entries may be added to form the relative path. In | ||
| all other cases, such as the paths referencing different drives, | ||
| :exc:`ValueError` is raised. |
brettcannon
changed the title
bpo-40358: add strict argument to pathlib.PurePath.relative_to
gh-84538: add strict argument to pathlib.PurePath.relative_to