@@ -624,18 +624,22 @@ def with_suffix(self, suffix):
624624 return self ._from_parsed_parts (self ._drv , self ._root ,
625625 self ._parts [:- 1 ] + [name ])
626626
627- def relative_to (self , * other , walk_up = False ):
627+ def relative_to (self , other , / , * _deprecated , walk_up = False ):
628628 """Return the relative path to another path identified by the passed
629629 arguments. If the operation is not possible (because this is not
630630 related to the other path), raise ValueError.
631631
632632 The *walk_up* parameter controls whether `..` may be used to resolve
633633 the path.
634634 """
635- if not other :
636- raise TypeError ("need at least one argument" )
635+ if _deprecated :
636+ msg = ("support for supplying more than one positional argument "
637+ "to pathlib.PurePath.relative_to() is deprecated and "
638+ "scheduled for removal in Python {remove}" )
639+ warnings ._deprecated ("pathlib.PurePath.relative_to(*args)" , msg ,
640+ remove = (3 , 14 ))
637641 path_cls = type (self )
638- other = path_cls (* other )
642+ other = path_cls (other , * _deprecated )
639643 for step , path in enumerate ([other ] + list (other .parents )):
640644 if self .is_relative_to (path ):
641645 break
@@ -646,12 +650,16 @@ def relative_to(self, *other, walk_up=False):
646650 parts = ('..' ,) * step + self .parts [len (path .parts ):]
647651 return path_cls (* parts )
648652
649- def is_relative_to (self , * other ):
653+ def is_relative_to (self , other , / , * _deprecated ):
650654 """Return True if the path is relative to another path or False.
651655 """
652- if not other :
653- raise TypeError ("need at least one argument" )
654- other = type (self )(* other )
656+ if _deprecated :
657+ msg = ("support for supplying more than one argument to "
658+ "pathlib.PurePath.is_relative_to() is deprecated and "
659+ "scheduled for removal in Python {remove}" )
660+ warnings ._deprecated ("pathlib.PurePath.is_relative_to(*args)" ,
661+ msg , remove = (3 , 14 ))
662+ other = type (self )(other , * _deprecated )
655663 return other == self or other in self .parents
656664
657665 @property
0 commit comments