diff options
author | Barney Gale <barney.gale@gmail.com> | 2024-01-26 18:14:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-26 18:14:24 (GMT) |
commit | 7e31d6dea276ac91402aefb023c58d239dfd9246 (patch) | |
tree | 3a32adf17e7fa06baa399363f57a079d4f631f24 /Doc/library/os.path.rst | |
parent | 6c2b419fb91c8d7daa769d39f73768114b5eb45a (diff) | |
download | cpython-7e31d6dea276ac91402aefb023c58d239dfd9246.zip cpython-7e31d6dea276ac91402aefb023c58d239dfd9246.tar.gz cpython-7e31d6dea276ac91402aefb023c58d239dfd9246.tar.bz2 |
gh-88569: add `ntpath.isreserved()` (#95486)
Add `ntpath.isreserved()`, which identifies reserved pathnames such as "NUL", "AUX" and "CON".
Deprecate `pathlib.PurePath.is_reserved()`.
---------
Co-authored-by: Eryk Sun <eryksun@gmail.com>
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Diffstat (limited to 'Doc/library/os.path.rst')
-rw-r--r-- | Doc/library/os.path.rst | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst index 3cab7a2..34bc76b 100644 --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -326,6 +326,28 @@ the :mod:`glob` module.) .. versionadded:: 3.12 +.. function:: isreserved(path) + + Return ``True`` if *path* is a reserved pathname on the current system. + + On Windows, reserved filenames include those that end with a space or dot; + those that contain colons (i.e. file streams such as "name:stream"), + wildcard characters (i.e. ``'*?"<>'``), pipe, or ASCII control characters; + as well as DOS device names such as "NUL", "CON", "CONIN$", "CONOUT$", + "AUX", "PRN", "COM1", and "LPT1". + + .. note:: + + This function approximates rules for reserved paths on most Windows + systems. These rules change over time in various Windows releases. + This function may be updated in future Python releases as changes to + the rules become broadly available. + + .. availability:: Windows. + + .. versionadded:: 3.13 + + .. function:: join(path, *paths) Join one or more path segments intelligently. The return value is the |