You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Windows reserves certain filenames like 'NUL'. Checking for these names is part of a small handful of functionality that is available in pathlib but not in os.path.
I propose that we add an os.path.isreserved() function, encorporating Eryk Sun's work on bpo-27827. We then adjust pathlib to call the new function.
By doing so, we move one of the few remaining OS-specific implementations in pathlib to low-level libraries (posixpath, ntpath) where it arguably belongs.
We also make this functionality available to the segment of people using traditional string-based path operations who don't want to dip their toes into pathlib just for reserved names.
Activity
barneygale commentedon Jun 12, 2021
Windows reserves certain filenames like 'NUL'. Checking for these names is part of a small handful of functionality that is available in pathlib but not in os.path.
I propose that we add an os.path.isreserved() function, encorporating Eryk Sun's work on bpo-27827. We then adjust pathlib to call the new function.
By doing so, we move one of the few remaining OS-specific implementations in pathlib to low-level libraries (posixpath, ntpath) where it arguably belongs.
We also make this functionality available to the segment of people using traditional string-based path operations who don't want to dip their toes into pathlib just for reserved names.
pythongh-88569: add `os.path.isreserved()`
gh-88569: add `ntpath.isreserved()` (#95486)
barneygale commentedon Jan 26, 2024
Resolved in 3.13 / 7e31d6d / #95486
pythongh-88569: add `ntpath.isreserved()` (python#95486)
pythongh-88569: add `ntpath.isreserved()` (python#95486)
py313: Avoid deprecated pathlib.PurePath.is_reserved()