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

Fix ntpath.normpath() for drive-relative paths #126780

Closed
nineteendo opened this issue Nov 13, 2024 · 0 comments
Closed

Fix ntpath.normpath() for drive-relative paths #126780

nineteendo opened this issue Nov 13, 2024 · 0 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error

Comments

@nineteendo
Copy link
Contributor

nineteendo commented Nov 13, 2024

Bug report

Bug description:

from @eryksun (#117855 (comment)):

Note that the behavior for normalizing drive-relative paths is currently wrong in this case on Windows:

>>> nt._path_normpath('C:./spam')
'C:.\\spam'

That's the result that we want here when returning an explicit current directory for internal use, but that's not the expected behavior for normpath(). The fallback implementation that's used on POSIX gets it right:

>>> ntpath.normpath('C:./spam')
'C:spam'

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

@nineteendo nineteendo added the type-bug An unexpected behavior, bug, or error label Nov 13, 2024
@picnixz picnixz added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Nov 14, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 21, 2024
…thonGH-126801)

(cherry picked from commit 60ec854)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
@zooba zooba closed this as completed Nov 21, 2024
zooba pushed a commit that referenced this issue Nov 21, 2024
(cherry picked from commit 60ec854)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants