Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into gh-110109-purepathbase
  • Loading branch information
barneygale committed Nov 12, 2023
commit 6c742ed5f1a5a0116ff8913ceee9631b3d08a288
6 changes: 4 additions & 2 deletions Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,9 @@ def relative_to(self, other, /, *_deprecated, walk_up=False):
"scheduled for removal in Python {remove}")
warnings._deprecated("pathlib.PurePath.relative_to(*args)", msg,
remove=(3, 14))
if not isinstance(other, _PurePathBase) or _deprecated:
other = self.with_segments(other, *_deprecated)
elif not isinstance(other, _PurePathBase):
other = self.with_segments(other)
for step, path in enumerate([other] + list(other.parents)):
if path == self or path in self.parents:
break
Expand All @@ -536,8 +537,9 @@ def is_relative_to(self, other, /, *_deprecated):
"scheduled for removal in Python {remove}")
warnings._deprecated("pathlib.PurePath.is_relative_to(*args)",
msg, remove=(3, 14))
if not isinstance(other, _PurePathBase) or _deprecated:
other = self.with_segments(other, *_deprecated)
elif not isinstance(other, _PurePathBase):
other = self.with_segments(other)
return other == self or other in self.parents

@property
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.