Skip to content

Commit 09b3e24

Browse files
committed
gh-133875: Remove deprecated pathlib.PurePath.is_reserved
1 parent 9b9cdb6 commit 09b3e24

5 files changed

Lines changed: 6 additions & 32 deletions

File tree

Doc/library/pathlib.rst

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -542,20 +542,6 @@ Pure paths provide the following methods and properties:
542542
Passing additional arguments is deprecated; if supplied, they are joined
543543
with *other*.
544544

545-
.. method:: PurePath.is_reserved()
546-
547-
With :class:`PureWindowsPath`, return ``True`` if the path is considered
548-
reserved under Windows, ``False`` otherwise. With :class:`PurePosixPath`,
549-
``False`` is always returned.
550-
551-
.. versionchanged:: 3.13
552-
Windows path names that contain a colon, or end with a dot or a space,
553-
are considered reserved. UNC paths may be reserved.
554-
555-
.. deprecated-removed:: 3.13 3.15
556-
This method is deprecated; use :func:`os.path.isreserved` to detect
557-
reserved paths on Windows.
558-
559545
.. method:: PurePath.joinpath(*pathsegments)
560546

561547
Calling this method is equivalent to combining the path with each of

Doc/whatsnew/3.15.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ Porting to Python 3.15
177177

178178
(Contributed by Serhiy Storchaka in :gh:`133595`.)
179179

180+
* Removed deprecated :meth:`!pathlib.PurePath.is_reserved`.
181+
Use :func:`os.path.isreserved` to detect reserved paths on Windows.
182+
(Contributed by Nikita Sobolev in :gh:`133875`.)
183+
180184
Deprecated C APIs
181185
-----------------
182186

Lib/pathlib/__init__.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -518,18 +518,6 @@ def is_absolute(self):
518518
return False
519519
return self.parser.isabs(self)
520520

521-
def is_reserved(self):
522-
"""Return True if the path contains one of the special names reserved
523-
by the system, if any."""
524-
import warnings
525-
msg = ("pathlib.PurePath.is_reserved() is deprecated and scheduled "
526-
"for removal in Python 3.15. Use os.path.isreserved() to "
527-
"detect reserved paths on Windows.")
528-
warnings._deprecated("pathlib.PurePath.is_reserved", msg, remove=(3, 15))
529-
if self.parser is ntpath:
530-
return self.parser.isreserved(self)
531-
return False
532-
533521
def as_uri(self):
534522
"""Return the path as a URI."""
535523
import warnings

Lib/test/test_pathlib/test_pathlib.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -539,12 +539,6 @@ def test_with_stem_empty(self):
539539
self.assertRaises(ValueError, P('a/b').with_stem, '')
540540
self.assertRaises(ValueError, P('a/b').with_stem, '.')
541541

542-
def test_is_reserved_deprecated(self):
543-
P = self.cls
544-
p = P('a/b')
545-
with self.assertWarns(DeprecationWarning):
546-
p.is_reserved()
547-
548542
def test_full_match_case_sensitive(self):
549543
P = self.cls
550544
self.assertFalse(P('A.py').full_match('a.PY', case_sensitive=True))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Removed deprecated :meth:`!pathlib.PurePath.is_reserved`. Use
2+
:func:`os.path.isreserved` to detect reserved paths on Windows.

0 commit comments

Comments
 (0)