[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-21 Thread Eryk Sun
Eryk Sun added the comment: > pathlib does not allow to distinguish "path" from "path/". os.path.normpath() and os.path.abspath() don't retain a trailing slash -- or a leading dot component for that matter. Are you referring to os.path.join()? For example: >>> os.path.join('./spam',

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > In the long run, it would be better to migrate the implementations in the > other direction. Rewrite genericpath, ntpath, posixpath, and parts of shutil > to use PurePath and Path objects. pathlib does not allow to distinguish "path" from "path/".

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-20 Thread Barney Gale
Barney Gale added the comment: Thanks both. I've adjusted PR 31338 to leave is_mount() unchanged. I've opened a new pull request that implements is_mount() on Windows using ntpath.ismount(): PR 31458 -- ___ Python tracker

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-18 Thread Terry J. Reedy
Terry J. Reedy added the comment: I think pathlib should be raising TypeError, ValueError, or something else as appropriate. Or not raising in situations Eryk indicated. x/0 *could* be +- float('inf'), but we don't raise NotImplementedError for it. -- nosy: +terry.reedy

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-15 Thread Eryk Sun
Eryk Sun added the comment: > I'm planning to learn more heavily on posixpath + ntpath in > pathlib once bpo-44136 is done. I think that would be a good > time to introduce is_mount() support on Windows. In the long run, it would be better to migrate the implementations in the other

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-15 Thread Barney Gale
Barney Gale added the comment: I'm planning to learn more heavily on posixpath + ntpath in pathlib once bpo-44136 is done. I think that would be a good time to introduce is_mount() support on Windows. -- ___ Python tracker

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-14 Thread Eryk Sun
Eryk Sun added the comment: WindowsPath.is_mount() should call ntpath.ismount(). This function needs a significant redesign, but it's fine to use it as long as it's documented that is_mount() is equivalent to os.path.ismount(). Since the owner() and group() methods return names instead of

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-14 Thread Barney Gale
Barney Gale added the comment: Thanks very much Alex. I've added some PRs: PR 31338 addresses owner(), group() and is_mount(). It moves those methods to PosixPath, and adds stubs in WindowsPath that raise deprecation warnings. I agree with your analysis that, for static typing purposes,

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-14 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +29491 pull_request: https://github.com/python/cpython/pull/31340 ___ Python tracker ___

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-14 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +29492 pull_request: https://github.com/python/cpython/pull/31341 ___ Python tracker ___

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-14 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +29490 pull_request: https://github.com/python/cpython/pull/31339 ___ Python tracker ___

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-14 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +29489 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31338 ___ Python tracker ___

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-13 Thread Éric Araujo
Change by Éric Araujo : -- nosy: +eric.araujo, pitrou, serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-12 Thread Alex Waygood
Alex Waygood added the comment: I suppose it might also be worth considering moving `owner()` and `group()` to PosixPath. In practice, these unconditionally raise NotImplementedError on Windows, since the pwd and grp modules are not available on Windows. So, in an ideal world, they probably

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-12 Thread Alex Waygood
Alex Waygood added the comment: Here's my two cents, as a non-expert when it comes to pathlib: I'm not really sure why `is_mount()` exists on WindowsPath objects, given that it unconditionally raises `NotImplementedError` on WindowsPath objects -- that seems *very* strange to me. It seems

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-12 Thread Alex Waygood
Change by Alex Waygood : -- keywords: -patch stage: patch review -> ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-12 Thread Alex Waygood
Change by Alex Waygood : -- pull_requests: -29461 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-12 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +29461 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31085 ___ Python tracker ___

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-12 Thread Barney Gale
New submission from Barney Gale : The docs for NotImplementedError say: > In user defined base classes, abstract methods should raise this exception > when they require derived classes to override the method, or while the class > is being developed to indicate that the real implementation