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

bpo-39682: make pathlib.Path immutable by removing (undocumented) support for "closing" a path by using it as a context manager #18846

Merged

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Mar 8, 2020

This implements @pitrou's suggestion of retaining support for using a Path object as a context manager, but making it a no-op.

https://bugs.python.org/issue39682

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@barneygale

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

+1 on the principle, but I don't think we should remove the test entirely, just change it.
Also, please add a NEWS entry. You can do so using blurb or blurb-it.

Lib/test/test_pathlib.py Outdated Show resolved Hide resolved
@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@barneygale barneygale force-pushed the bpo-39682-pathlib-path-context-manager branch from 626c970 to c89a62d Compare March 8, 2020 10:51
@barneygale
Copy link
Contributor Author

I have made the requested changes; please review again. Thank you!

@bedevere-bot
Copy link

Thanks for making the requested changes!

@pitrou: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from pitrou March 8, 2020 11:02
Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

+1. Have you signed the CLA?

@barneygale
Copy link
Contributor Author

I have! I think it's just making its way through the system currently.

@pitrou
Copy link
Member

pitrou commented Mar 8, 2020

Cool, thank you. I'll wait for the bot to notice, then :-)

Copy link
Member

@brettcannon brettcannon left a comment

Choose a reason for hiding this comment

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

Quick request to document in the code why this change is being made, else someone else in the future may be wondering why it's a no-op.

Lib/test/test_pathlib.py Outdated Show resolved Hide resolved
Lib/pathlib.py Show resolved Hide resolved
@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@barneygale
Copy link
Contributor Author

Thank you Brett. I have made the requested changes; please review again. Hope the comment isn't too long.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@brettcannon, @pitrou: please review the changes made to this pull request.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@barneygale barneygale force-pushed the bpo-39682-pathlib-path-context-manager branch from 86cf4dc to ca3acfd Compare March 21, 2020 01:50
@barneygale
Copy link
Contributor Author

I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@pitrou, @brettcannon: please review the changes made to this pull request.

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

+1 for this, thank you @barneygale .
I'll leave this open a day or two in case people hold strong opinions about deprecating this silent behaviour.

@pitrou
Copy link
Member

pitrou commented Mar 28, 2020

@barneygale Can you rebase/merge from master to re-run CI on this?

…upport for "closing" a path by using it as a context manager.

Support for using a path as a context manager remains, and is now a no-op.

Co-Authored-By: Brett Cannon <54418+brettcannon@users.noreply.github.com>
@barneygale barneygale force-pushed the bpo-39682-pathlib-path-context-manager branch from ca3acfd to 31c116a Compare March 29, 2020 19:34
@barneygale
Copy link
Contributor Author

Rebased on master. Thanks @pitrou and @brettcannon for helping get this through :)

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
Copy link
Contributor

@aeros aeros left a comment

Choose a reason for hiding this comment

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

Thanks @barneygale; LGTM.

@brettcannon
Copy link
Member

brettcannon commented Mar 30, 2020

I have an opinion about deprecation, but it isn't strong. 😄 Basically I'm worried someone out there is relying on this functionality and is going to be caught off-guard that it suddenly stopped working. But as I said, I'm +0 on the deprecation so I won't hold up the PR if people disagree.

@barneygale
Copy link
Contributor Author

barneygale commented Apr 3, 2020

Just noting that I have a follow-up PR - #19342 - that removes the _init() method that was touched by this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants