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-73991: Rework pathlib.Path.copytree() into copy() #122369

Merged
merged 20 commits into from
Aug 11, 2024

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Jul 27, 2024

Rename pathlib.Path.copy() to _copy_file() (i.e. make it private.)

Rename pathlib.Path.copytree() to copy(), and add support for copying non-directories. This simplifies the interface for users, and nicely complements the upcoming move() and delete() methods (which will also accept any type of file.)


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

Rename `pathlib.Path.copy()` to `_copy_file()` (i.e. make it private.)

Rename `pathlib.Path.copytree()` to `copy()`, and add support for copying
non-directories. This simplifies the interface for users, and nicely
complements the upcoming `move()` and `delete()` methods (which will also
accept any type of file.)
@barneygale barneygale marked this pull request as ready for review July 30, 2024 17:21
@barneygale
Copy link
Contributor Author

Making the old copy() method private was a bit of a can of worms, as it made our usage of _winapi.CopyFile2 simpler, which in turn removed any need for UnsupportedOperation to be defined in _os.py rather than _abc.py.

@barneygale
Copy link
Contributor Author

Hey @nineteendo, could you review this please, if you're up for it? Thanks in advance!

Doc/library/pathlib.rst Outdated Show resolved Hide resolved
Lib/pathlib/_abc.py Show resolved Hide resolved
Doc/library/pathlib.rst Outdated Show resolved Hide resolved
Doc/library/pathlib.rst Outdated Show resolved Hide resolved
@barneygale barneygale requested a review from nineteendo August 4, 2024 15:53
Doc/library/pathlib.rst Outdated Show resolved Hide resolved
Doc/library/pathlib.rst Outdated Show resolved Hide resolved
Doc/library/pathlib.rst Outdated Show resolved Hide resolved
Lib/pathlib/__init__.py Outdated Show resolved Hide resolved
Lib/pathlib/_abc.py Show resolved Hide resolved
Lib/pathlib/_abc.py Outdated Show resolved Hide resolved
Lib/pathlib/_abc.py Show resolved Hide resolved
@barneygale barneygale requested a review from AA-Turner August 11, 2024 19:10
Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

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

Danke!

A

@barneygale
Copy link
Contributor Author

Thank you for the review, very helpful!

@barneygale barneygale merged commit a6644d4 into python:main Aug 11, 2024
36 checks passed
blhsing pushed a commit to blhsing/cpython that referenced this pull request Aug 22, 2024
…n#122369)

Rename `pathlib.Path.copy()` to `_copy_file()` (i.e. make it private.)

Rename `pathlib.Path.copytree()` to `copy()`, and add support for copying
non-directories. This simplifies the interface for users, and nicely
complements the upcoming `move()` and `delete()` methods (which will also
accept any type of file.)

Co-authored-by: Adam Turner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants