Skip to content

Conversation

@barneygale
Copy link
Contributor

@barneygalebarneygale 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.)
@barneygalebarneygale marked this pull request as ready for review July 30, 2024 17:21
@barneygale
Copy link
ContributorAuthor

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
ContributorAuthor

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

barneygaleand others added 2 commits August 7, 2024 16:11
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Copy link
Member

@AA-TurnerAA-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
ContributorAuthor

Thank you for the review, very helpful!

@barneygalebarneygale merged commit a6644d4 into python:mainAug 11, 2024
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 <9087854+AA-Turner@users.noreply.github.com>
Sign up for freeto 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

@barneygale@AA-Turner@nineteendo