diff options
author | Barney Gale <barney.gale@gmail.com> | 2023-12-27 15:40:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 15:40:03 (GMT) |
commit | 1b19d7376818d14ab865fa22cb66baeacdb88277 (patch) | |
tree | dd51850f3490433f17896c242eb7c21ad8e77546 /Lib/pathlib | |
parent | f8b6e171ad79bf3e57e39ebc0d96ad097a310cbf (diff) | |
download | cpython-1b19d7376818d14ab865fa22cb66baeacdb88277.zip cpython-1b19d7376818d14ab865fa22cb66baeacdb88277.tar.gz cpython-1b19d7376818d14ab865fa22cb66baeacdb88277.tar.bz2 |
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.
Diffstat (limited to 'Lib/pathlib')
-rw-r--r-- | Lib/pathlib/_abc.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/pathlib/_abc.py b/Lib/pathlib/_abc.py index cfd59ec..efe56ec 100644 --- a/Lib/pathlib/_abc.py +++ b/Lib/pathlib/_abc.py @@ -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) |