Skip to content

Commit

Permalink
pythonGH-110109: pathlib ABCs: drop use of warnings._deprecated() (p…
Browse files Browse the repository at this point in the history
…ython#113419)

The `pathlib._abc` module will be made available as a PyPI backport
supporting Python 3.8+. The `warnings._deprecated()` function was only
added last year, and it's private from an external package perspective, so
here we switch to `warnings.warn()` instead.
  • Loading branch information
barneygale authored and kulikjak committed Jan 22, 2024
1 parent de5e342 commit f7c9f12
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Lib/pathlib/_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,8 @@ def relative_to(self, other, /, *_deprecated, walk_up=False):
if _deprecated:
msg = ("support for supplying more than one positional argument "
"to pathlib.PurePath.relative_to() is deprecated and "
"scheduled for removal in Python {remove}")
warnings._deprecated("pathlib.PurePath.relative_to(*args)", msg,
remove=(3, 14))
"scheduled for removal in Python 3.14")
warnings.warn(msg, DeprecationWarning, stacklevel=2)
other = self.with_segments(other, *_deprecated)
elif not isinstance(other, PurePathBase):
other = self.with_segments(other)
Expand All @@ -419,9 +418,8 @@ def is_relative_to(self, other, /, *_deprecated):
if _deprecated:
msg = ("support for supplying more than one argument to "
"pathlib.PurePath.is_relative_to() is deprecated and "
"scheduled for removal in Python {remove}")
warnings._deprecated("pathlib.PurePath.is_relative_to(*args)",
msg, remove=(3, 14))
"scheduled for removal in Python 3.14")
warnings.warn(msg, DeprecationWarning, stacklevel=2)
other = self.with_segments(other, *_deprecated)
elif not isinstance(other, PurePathBase):
other = self.with_segments(other)
Expand Down

0 comments on commit f7c9f12

Please sign in to comment.