* :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.
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
* :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`.)
(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
--------
The |pythoncapi_compat_project| can be used to get most of these new
functions on Python 3.14 and older.
+
Deprecated C APIs
-----------------
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
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))
.. 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.
..
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`.
..
--- /dev/null
+Removed deprecated :meth:`!pathlib.PurePath.is_reserved`. Use
+:func:`os.path.isreserved` to detect reserved paths on Windows.