Skip to content

Commit 67036f1

Browse files
authored
gh-133875: Remove deprecated pathlib.PurePath.is_reserved (#133876)
1 parent 7ae4749 commit 67036f1

File tree

9 files changed

+15
-36
lines changed

9 files changed

+15
-36
lines changed

Doc/deprecations/pending-removal-in-3.15.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Pending removal in Python 3.15
4545

4646
* :mod:`pathlib`:
4747

48-
* :meth:`.PurePath.is_reserved`
48+
* :meth:`!.PurePath.is_reserved`
4949
has been deprecated since Python 3.13.
5050
Use :func:`os.path.isreserved` to detect reserved paths on Windows.
5151

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.13.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,7 @@ New Deprecations
19171917

19181918
* :mod:`pathlib`:
19191919

1920-
* Deprecate :meth:`.PurePath.is_reserved`,
1920+
* Deprecate :meth:`!.PurePath.is_reserved`,
19211921
to be removed in Python 3.15.
19221922
Use :func:`os.path.isreserved` to detect reserved paths on Windows.
19231923
(Contributed by Barney Gale in :gh:`88569`.)

Doc/whatsnew/3.15.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,14 @@ http.server
373373
(Contributed by Bénédikt Tran in :gh:`133810`.)
374374

375375

376+
pathlib
377+
-------
378+
379+
* Removed deprecated :meth:`!pathlib.PurePath.is_reserved`.
380+
Use :func:`os.path.isreserved` to detect reserved paths on Windows.
381+
(Contributed by Nikita Sobolev in :gh:`133875`.)
382+
383+
376384
platform
377385
--------
378386

@@ -482,6 +490,7 @@ Porting to Python 3.15
482490
The |pythoncapi_compat_project| can be used to get most of these new
483491
functions on Python 3.14 and older.
484492

493+
485494
Deprecated C APIs
486495
-----------------
487496

Lib/pathlib/__init__.py

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

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

Misc/NEWS.d/3.11.0a1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2741,7 +2741,7 @@ Fix deprecation of :data:`ssl.OP_NO_TLSv1_3`
27412741
.. nonce: TMWh1i
27422742
.. section: Library
27432743
2744-
:meth:`pathlib.PureWindowsPath.is_reserved` now identifies a greater range
2744+
:meth:`!pathlib.PureWindowsPath.is_reserved` now identifies a greater range
27452745
of reserved filenames, including those with trailing spaces or colons.
27462746

27472747
..

Misc/NEWS.d/3.13.0a4.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ Also changed its name and daemonic status, it can be now joined.
10961096
Add :func:`os.path.isreserved`, which identifies reserved pathnames such as
10971097
"NUL", "AUX" and "CON". This function is only available on Windows.
10981098

1099-
Deprecate :meth:`pathlib.PurePath.is_reserved`.
1099+
Deprecate :meth:`!pathlib.PurePath.is_reserved`.
11001100

11011101
..
11021102
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy