[issue46733] pathlib.Path methods can raise NotImplementedError

Barney Gale report at bugs.python.org
Mon Feb 14 16:01:14 EST 2022


Barney Gale <barney.gale at gmail.com> 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, these methods shouldn't even exist on WindowsPath!

PR 31339 addresses readlink(), symlink_to() and hardlink_to(). In this case I'm working towards making those methods unavailable if os.readlink(), symlink() and link() are unavailable. Not totally sold on this - thoughts?

PR 31340 addresses glob() and rglob(), switching the exception type to ValueError. I think this is a legitimate bugfix with minimal adverse effects.

PR 31341 addresses the Path constructor. This is a backwards incompatible change, and /probably/ not worth doing. I add it for completeness sake, as these four PRs cover all cases where pathlib raises NotImplementedError.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46733>
_______________________________________


More information about the Python-bugs-list mailing list