]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-133875: Remove deprecated `pathlib.PurePath.is_reserved` (#133876)
authorsobolevn <mail@sobolevn.me>
Sat, 19 Jul 2025 17:07:46 +0000 (20:07 +0300)
committerGitHub <noreply@github.com>
Sat, 19 Jul 2025 17:07:46 +0000 (17:07 +0000)
Doc/deprecations/pending-removal-in-3.15.rst
Doc/library/pathlib.rst
Doc/whatsnew/3.13.rst
Doc/whatsnew/3.15.rst
Lib/pathlib/__init__.py
Lib/test/test_pathlib/test_pathlib.py
Misc/NEWS.d/3.11.0a1.rst
Misc/NEWS.d/3.13.0a4.rst
Misc/NEWS.d/next/Library/2025-05-11-11-39-05.gh-issue-133875.pUar3l.rst [new file with mode: 0644]

index c5ca599bb04a6f429a7801bf5c644a0c7689ea77..9505bcfa05af11c7e92f704319b802160214e2bd 100644 (file)
@@ -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.
 
index 47986a2d9602ee410b72ba742ad39fce1c78c4e1..ebf5756146df925b876604473b4884bd2fab8fbd 100644 (file)
@@ -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
index 0a3b3b30e016daeb8723aab3134da8338fde5090..126329b538db31427db47857daf6235ba49150d6 100644 (file)
@@ -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`.)
index ea369a3698349730f8fbc88545d1ec1552dc389b..0f65317633ba70ef551159c1adf9aaa7a9d3bd9b 100644 (file)
@@ -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
 -----------------
 
index 2dc1f7f7126063ac09d104260174da2a6f67eb63..fd073445e89b62a4b97aea3ffcf072596ad5ccad 100644 (file)
@@ -519,18 +519,6 @@ class PurePath:
             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
index b2e2cdb3338beb464a7bddef22f517a40849d17d..16d30e3ca2d17da579e10827ecd3bbb5a2344c28 100644 (file)
@@ -539,12 +539,6 @@ class PurePathTest(unittest.TestCase):
         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))
index 0b49c2a78771d26b8a56352f7e4d3debd68e3a7f..2c8e349d3c8bfb8d132980fb34deff641b53d74a 100644 (file)
@@ -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.
 
 ..
index 1b971113173e0a55f6c7fcdf60b48f886ffd4106..8afbe1b77f7cb8c9b6279d22f2b135aa0db54ecd 100644 (file)
@@ -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 (file)
index 0000000..b4a2b03
--- /dev/null
@@ -0,0 +1,2 @@
+Removed deprecated :meth:`!pathlib.PurePath.is_reserved`. Use
+:func:`os.path.isreserved` to detect reserved paths on Windows.