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

gh-86943: implement pathlib.WindowsPath.is_mount() #31458

Merged

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Feb 21, 2022

Have pathlib.WindowsPath.is_mount() call ntpath.ismount(). Previously it raised NotImplementedError unconditionally.

https://bugs.python.org/issue42777

Automerge-Triggered-By: GH:brettcannon

@barneygale barneygale marked this pull request as draft February 21, 2022 03:17
Doc/library/pathlib.rst Outdated Show resolved Hide resolved
@AlexWaygood AlexWaygood added the type-feature A feature request or enhancement label Apr 10, 2022
@zmievsa
Copy link
Contributor

zmievsa commented May 19, 2022

Will review soon

@barneygale
Copy link
Contributor Author

Will review soon

Don't worry about it - I'm trying to focus my efforts on two more important PRs: #31691 and #91882. The branch has conflicts anyway.

@barneygale barneygale marked this pull request as ready for review July 30, 2022 17:17
@barneygale barneygale changed the title bpo-42777: implement pathlib.WindowsPath.is_mount() gh-86943: implement pathlib.WindowsPath.is_mount() Jul 30, 2022
@barneygale
Copy link
Contributor Author

barneygale commented Jul 30, 2022

Not sure what's going on with the test failure - looks like ntpath.ismount('C:/\x00') is true in main? It raises an exception in my Windows VM with Python 3.10.

@eryksun
Copy link
Contributor

eryksun commented Jul 30, 2022

Not sure what's going on with the test failure - looks like ntpath.ismount('C:/\x00') is true in main? It raises an exception in my Windows VM with Python 3.10.

The new implementation of normpath() strips the trailing null character. The old implementation keeps it.

These paths are invalid on posix and windows.
@eryksun
Copy link
Contributor

eryksun commented Jul 31, 2022

The new implementation of normpath() strips the trailing null character. The old implementation keeps it.

Do you think this needs to be fixed, or is it an improvement?

@barneygale
Copy link
Contributor Author

Do you think this needs to be fixed, or is it an improvement?

I think it's unlikely to come up in real world usage. IMO it's one of the quirks noted in 99fcf15:

This commit attempts to preserve every previously tested quirk, but these may be changed in the future to better align platforms.

iritkatriel pushed a commit to iritkatriel/cpython that referenced this pull request Aug 11, 2022
…31458)

Have `pathlib.WindowsPath.is_mount()` call `ntpath.ismount()`. Previously it raised `NotImplementedError` unconditionally.


https://bugs.python.org/issue42777
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-pathlib type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants