GH-89812: Add pathlib.UnsupportedOperation by barneygale · Pull Request #105926 · python/cpython (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation4 Commits3 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

barneygale

Contributor

@barneygale barneygale commented

Jun 19, 2023

edited by github-actionsbot

Loading

This new exception type is raised instead of NotImplementedError when a path operation is not supported. It can be raised from Path.readlink(), symlink_to(), hardlink_to(), owner() and group(). In a future version of pathlib, it will be raised by AbstractPath for these methods and others, such as AbstractPath.mkdir() and unlink().


📚 Documentation preview 📚: https://cpython-previews--105926.org.readthedocs.build/

@barneygale

This new exception type is raised instead of NotImplementedError when a path operation is not supported. It can be raised from Path.readlink(), symlink_to(), hardlink_to(), owner() and group(). In a future version of pathlib, it will be raised by AbstractPath for these methods and others, such as AbstractPath.mkdir() and unlink().

@barneygale barneygale changed the titleGH-89812: Add pathlib.UnsupportedOperation GH-89812: Add pathlib.UnsupportedOperation

Jun 19, 2023

@encukou

Looks good, thank you!

I'd add versionadded notes to the docs of all the functions, since we can't expect readers to check the docs for UnsupportedOperation.

@barneygale

@barneygale

Good shout, thank you. I've done it via .. versionchanged directives on each method - does it look OK?

@barneygale

encukou

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@barneygale

Thanks very much for the idea and review!

bentasker pushed a commit to bentasker/cpython that referenced this pull request

Jun 23, 2023

@barneygale @bentasker

This new exception type is raised instead of NotImplementedError when a path operation is not supported. It can be raised from Path.readlink(), symlink_to(), hardlink_to(), owner() and group(). In a future version of pathlib, it will be raised by AbstractPath for these methods and others, such as AbstractPath.mkdir() and unlink().