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: Add pathlib.Path.move that can handle rename across FS #30650

Closed
wants to merge 2 commits into from

Conversation

oz123
Copy link
Contributor

@oz123 oz123 commented Jan 17, 2022

With this change, Pathlib.move adds the ability
to handle renaming across file system and also preserve metadata
when renaming, since shutil.move using shutil.copy2 is used
under the hood.

https://bugs.python.org/issue46317

https://bugs.python.org/issue46317

@oz123 oz123 changed the title bpo-46317: Add Pathlib.move that can handle rename across FS bpo-46317: Add pathlib.Path.move that can handle rename across FS Jan 17, 2022
Copy link
Contributor

@barneygale barneygale left a comment

Choose a reason for hiding this comment

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

I'd prefer metadata=True over copy_function=shutil.copy2, and would like to request a third opinion :-)

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
Doc/library/pathlib.rst Outdated Show resolved Hide resolved
Lib/pathlib.py Outdated Show resolved Hide resolved
Lib/test/test_pathlib.py Show resolved Hide resolved
@oz123 oz123 force-pushed the bpo-46317-pathlib-move branch 2 times, most recently from 9d35c9a to b20e32f Compare January 24, 2022 22:35
Lib/pathlib.py Outdated Show resolved Hide resolved
With this change, ``pathlib.Path.move`` adds the ability
to handle renaming across file system and also preserve metadata
when renaming, since ``shutil.move`` using ``shutil.copy2`` is used
under the hood.
Copy link
Contributor

@MaxwellDupre MaxwellDupre left a comment

Choose a reason for hiding this comment

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

Ran 462 tests in 3.520s
OK (skipped=137)
Added test passed. Looks ok.

@oz123 oz123 mannequin mentioned this pull request Jun 21, 2022
@barneygale barneygale changed the title bpo-46317: Add pathlib.Path.move that can handle rename across FS GH-73991: Add pathlib.Path.move that can handle rename across FS Apr 14, 2023
@barneygale
Copy link
Contributor

I'm going to close this PR because I've added a (different) implementation of move() in GH-122073. Thank you.

@barneygale barneygale closed this Aug 26, 2024
@oz123
Copy link
Contributor Author

oz123 commented Aug 26, 2024

Thanks for letting me know. I'm happy that the issue is finally resolved.

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.

7 participants