https://github.com/python/cpython/commit/67036f1ee1c23257d320a80c152090235b8ca892
commit: 67036f1ee1c23257d320a80c152090235b8ca892
branch: main
author: sobolevn <[email protected]>
committer: sobolevn <[email protected]>
date: 2025-07-19T17:07:46Z
summary:

gh-133875: Remove deprecated `pathlib.PurePath.is_reserved` (#133876)

files:
A Misc/NEWS.d/next/Library/2025-05-11-11-39-05.gh-issue-133875.pUar3l.rst
M Doc/deprecations/pending-removal-in-3.15.rst
M Doc/library/pathlib.rst
M Doc/whatsnew/3.13.rst
M Doc/whatsnew/3.15.rst
M Lib/pathlib/__init__.py
M Lib/test/test_pathlib/test_pathlib.py
M Misc/NEWS.d/3.11.0a1.rst
M Misc/NEWS.d/3.13.0a4.rst

diff --git a/Doc/deprecations/pending-removal-in-3.15.rst 
b/Doc/deprecations/pending-removal-in-3.15.rst
index c5ca599bb04a6f..9505bcfa05af11 100644
--- a/Doc/deprecations/pending-removal-in-3.15.rst
+++ b/Doc/deprecations/pending-removal-in-3.15.rst
@@ -45,7 +45,7 @@ Pending removal in Python 3.15
 
 * :mod:`pathlib`:
 
-  * :meth:`.PurePath.is_reserved`
+  * :meth:`!.PurePath.is_reserved`
     has been deprecated since Python 3.13.
     Use :func:`os.path.isreserved` to detect reserved paths on Windows.
 
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst
index 47986a2d9602ee..ebf5756146df92 100644
--- a/Doc/library/pathlib.rst
+++ b/Doc/library/pathlib.rst
@@ -542,20 +542,6 @@ Pure paths provide the following methods and properties:
       Passing additional arguments is deprecated; if supplied, they are joined
       with *other*.
 
-.. method:: PurePath.is_reserved()
-
-   With :class:`PureWindowsPath`, return ``True`` if the path is considered
-   reserved under Windows, ``False`` otherwise.  With :class:`PurePosixPath`,
-   ``False`` is always returned.
-
-   .. versionchanged:: 3.13
-      Windows path names that contain a colon, or end with a dot or a space,
-      are considered reserved. UNC paths may be reserved.
-
-   .. deprecated-removed:: 3.13 3.15
-      This method is deprecated; use :func:`os.path.isreserved` to detect
-      reserved paths on Windows.
-
 .. method:: PurePath.joinpath(*pathsegments)
 
    Calling this method is equivalent to combining the path with each of
diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst
index 0a3b3b30e016da..126329b538db31 100644
--- a/Doc/whatsnew/3.13.rst
+++ b/Doc/whatsnew/3.13.rst
@@ -1917,7 +1917,7 @@ New Deprecations
 
 * :mod:`pathlib`:
 
-  * Deprecate :meth:`.PurePath.is_reserved`,
+  * Deprecate :meth:`!.PurePath.is_reserved`,
     to be removed in Python 3.15.
     Use :func:`os.path.isreserved` to detect reserved paths on Windows.
     (Contributed by Barney Gale in :gh:`88569`.)
diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst
index ea369a36983497..0f65317633ba70 100644
--- a/Doc/whatsnew/3.15.rst
+++ b/Doc/whatsnew/3.15.rst
@@ -373,6 +373,14 @@ http.server
   (Contributed by Bénédikt Tran in :gh:`133810`.)
 
 
+pathlib
+-------
+
+* Removed deprecated :meth:`!pathlib.PurePath.is_reserved`.
+  Use :func:`os.path.isreserved` to detect reserved paths on Windows.
+  (Contributed by Nikita Sobolev in :gh:`133875`.)
+
+
 platform
 --------
 
@@ -482,6 +490,7 @@ Porting to Python 3.15
   The |pythoncapi_compat_project| can be used to get most of these new
   functions on Python 3.14 and older.
 
+
 Deprecated C APIs
 -----------------
 
diff --git a/Lib/pathlib/__init__.py b/Lib/pathlib/__init__.py
index 2dc1f7f7126063..fd073445e89b62 100644
--- a/Lib/pathlib/__init__.py
+++ b/Lib/pathlib/__init__.py
@@ -519,18 +519,6 @@ def is_absolute(self):
             return False
         return self.parser.isabs(self)
 
-    def is_reserved(self):
-        """Return True if the path contains one of the special names reserved
-        by the system, if any."""
-        import warnings
-        msg = ("pathlib.PurePath.is_reserved() is deprecated and scheduled "
-               "for removal in Python 3.15. Use os.path.isreserved() to "
-               "detect reserved paths on Windows.")
-        warnings._deprecated("pathlib.PurePath.is_reserved", msg, remove=(3, 
15))
-        if self.parser is ntpath:
-            return self.parser.isreserved(self)
-        return False
-
     def as_uri(self):
         """Return the path as a URI."""
         import warnings
diff --git a/Lib/test/test_pathlib/test_pathlib.py 
b/Lib/test/test_pathlib/test_pathlib.py
index b2e2cdb3338beb..16d30e3ca2d17d 100644
--- a/Lib/test/test_pathlib/test_pathlib.py
+++ b/Lib/test/test_pathlib/test_pathlib.py
@@ -539,12 +539,6 @@ def test_with_stem_empty(self):
         self.assertRaises(ValueError, P('a/b').with_stem, '')
         self.assertRaises(ValueError, P('a/b').with_stem, '.')
 
-    def test_is_reserved_deprecated(self):
-        P = self.cls
-        p = P('a/b')
-        with self.assertWarns(DeprecationWarning):
-            p.is_reserved()
-
     def test_full_match_case_sensitive(self):
         P = self.cls
         self.assertFalse(P('A.py').full_match('a.PY', case_sensitive=True))
diff --git a/Misc/NEWS.d/3.11.0a1.rst b/Misc/NEWS.d/3.11.0a1.rst
index 0b49c2a78771d2..2c8e349d3c8bfb 100644
--- a/Misc/NEWS.d/3.11.0a1.rst
+++ b/Misc/NEWS.d/3.11.0a1.rst
@@ -2741,7 +2741,7 @@ Fix deprecation of :data:`ssl.OP_NO_TLSv1_3`
 .. nonce: TMWh1i
 .. section: Library
 
-:meth:`pathlib.PureWindowsPath.is_reserved` now identifies a greater range
+:meth:`!pathlib.PureWindowsPath.is_reserved` now identifies a greater range
 of reserved filenames, including those with trailing spaces or colons.
 
 ..
diff --git a/Misc/NEWS.d/3.13.0a4.rst b/Misc/NEWS.d/3.13.0a4.rst
index 1b971113173e0a..8afbe1b77f7cb8 100644
--- a/Misc/NEWS.d/3.13.0a4.rst
+++ b/Misc/NEWS.d/3.13.0a4.rst
@@ -1096,7 +1096,7 @@ Also changed its name and daemonic status, it can be now 
joined.
 Add :func:`os.path.isreserved`, which identifies reserved pathnames such as
 "NUL", "AUX" and "CON". This function is only available on Windows.
 
-Deprecate :meth:`pathlib.PurePath.is_reserved`.
+Deprecate :meth:`!pathlib.PurePath.is_reserved`.
 
 ..
 
diff --git 
a/Misc/NEWS.d/next/Library/2025-05-11-11-39-05.gh-issue-133875.pUar3l.rst 
b/Misc/NEWS.d/next/Library/2025-05-11-11-39-05.gh-issue-133875.pUar3l.rst
new file mode 100644
index 00000000000000..b4a2b0336370bc
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-05-11-11-39-05.gh-issue-133875.pUar3l.rst
@@ -0,0 +1,2 @@
+Removed deprecated :meth:`!pathlib.PurePath.is_reserved`. Use
+:func:`os.path.isreserved` to detect reserved paths on Windows.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to