Skip to content

Commit 6abcc0e

Browse files
barneygaleaisk
authored andcommitted
pythonGH-110109: pathlib ABCs: drop use of warnings._deprecated() (python#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.
1 parent b08ec58 commit 6abcc0e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Lib/pathlib/_abc.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,8 @@ def relative_to(self, other, /, *_deprecated, walk_up=False):
395395
if _deprecated:
396396
msg = ("support for supplying more than one positional argument "
397397
"to pathlib.PurePath.relative_to() is deprecated and "
398-
"scheduled for removal in Python {remove}")
399-
warnings._deprecated("pathlib.PurePath.relative_to(*args)", msg,
400-
remove=(3, 14))
398+
"scheduled for removal in Python 3.14")
399+
warnings.warn(msg, DeprecationWarning, stacklevel=2)
401400
other = self.with_segments(other, *_deprecated)
402401
elif not isinstance(other, PurePathBase):
403402
other = self.with_segments(other)
@@ -419,9 +418,8 @@ def is_relative_to(self, other, /, *_deprecated):
419418
if _deprecated:
420419
msg = ("support for supplying more than one argument to "
421420
"pathlib.PurePath.is_relative_to() is deprecated and "
422-
"scheduled for removal in Python {remove}")
423-
warnings._deprecated("pathlib.PurePath.is_relative_to(*args)",
424-
msg, remove=(3, 14))
421+
"scheduled for removal in Python 3.14")
422+
warnings.warn(msg, DeprecationWarning, stacklevel=2)
425423
other = self.with_segments(other, *_deprecated)
426424
elif not isinstance(other, PurePathBase):
427425
other = self.with_segments(other)

0 commit comments

Comments
 (0)