8000 Add os.path.isreserved() function · Issue #88569 · python/cpython · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add os.path.isreserved() function #88569

Closed
barneygale mannequin opened this issue Jun 12, 2021 · 2 comments
Closed

Add os.path.isreserved() function #88569

barneygale mannequin opened this issue Jun 12, 2021 · 2 comments
Labels
stdlib Python modules in the Lib dir topic-pathlib type-feature A feature request or enhancement

Comments

@barneygale
Copy link
Mannequin
barneygale mannequin commented Jun 12, 2021
BPO 44403
Nosy @barneygale

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-06-12.19:52:47.516>
labels = ['type-feature', 'library']
title = 'Add os.path.isreserved() function'
updated_at = <Date 2021-06-12.19:52:47.516>
user = 'https://github.com/barneygale'

bugs.python.org fields:

activity = <Date 2021-06-12.19:52:47.516>
actor = 'barneygale'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2021-06-12.19:52:47.516>
creator = 'barneygale'
dependencies = []
files = []
hgrepos = []
issue_num = 44403
keywords = []
message_count = 1.0
messages = ['395702']
nosy_count = 1.0
nosy_names = ['barneygale']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue44403'
versions = []

Linked PRs

@barneygale
Copy link
Mannequin Author
barneygale mannequin commented 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.

@barneygale barneygale mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jun 12, 2021
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
barneygale added a commit to barneygale/cpython that referenced this issue Jul 31, 2022
barneygale added a commit that referenced this issue Jan 26, 2024
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>
@barneygale
Copy link
Contributor

Resolved in 3.13 / 7e31d6d / #95486

aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
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>
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
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>
The-Compiler added a commit to qutebrowser/qutebrowser that referenced this issue Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir topic-pathlib type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant
0