GH-110109: pathlib ABCs: drop use of `warnings._deprecated()` (#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.
This commit is contained in:
Barney Gale 2023-12-27 15:40:03 +00:00 committed by GitHub
parent f8b6e171ad
commit 1b19d73768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -395,9 +395,8 @@ class PurePathBase:
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)
@ -419,9 +418,8 @@ class PurePathBase:
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)