Skip to content

GH-73991: Add pathlib.Path.move that can handle rename across FS - #30650

Closed
oz123 wants to merge 2 commits into
python:mainfrom
oz123:bpo-46317-pathlib-move
Closed

GH-73991: Add pathlib.Path.move that can handle rename across FS#30650
oz123 wants to merge 2 commits into
python:mainfrom
oz123:bpo-46317-pathlib-move

Conversation

@oz123

@oz123oz123 commented Jan 17, 2022

Copy link
Copy Markdown
Contributor

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
oz123force-pushed the bpo-46317-pathlib-move branch from b885731 to b3f4752CompareJanuary 17, 2022 19:48
@oz123oz123 changed the title bpo-46317: Add Pathlib.move that can handle rename across FSbpo-46317: Add pathlib.Path.move that can handle rename across FSJan 17, 2022
@oz123
oz123force-pushed the bpo-46317-pathlib-move branch from b3f4752 to 673f1c9CompareJanuary 17, 2022 19:50

@barneygalebarneygale left a comment

Copy link
Copy Markdown
Contributor

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 :-)

Comment threadDoc/library/pathlib.rst Outdated
Comment threadDoc/library/pathlib.rst Outdated
Comment threadDoc/library/pathlib.rst Outdated
Comment threadDoc/library/pathlib.rst Outdated
Comment threadLib/pathlib.py Outdated
Comment threadLib/test/test_pathlib.py Outdated
@oz123
oz123force-pushed the bpo-46317-pathlib-move branch 2 times, most recently from 9d35c9a to b20e32fCompareJanuary 24, 2022 22:35
@oz123
oz123force-pushed the bpo-46317-pathlib-move branch from b20e32f to 84157e1CompareFebruary 4, 2022 13:09
Comment threadLib/pathlib.py Outdated
@oz123
oz123force-pushed the bpo-46317-pathlib-move branch from bb1a964 to 29dfb12CompareFebruary 5, 2022 23:21
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.
@oz123
oz123force-pushed the bpo-46317-pathlib-move branch from 29dfb12 to edce418CompareFebruary 6, 2022 20:22

@MaxwellDupreMaxwellDupre left a comment

Copy link
Copy Markdown
Contributor

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.

@oz123oz123mannequin mentioned this pull request Jun 21, 2022
@barneygalebarneygale changed the title bpo-46317: Add pathlib.Path.move that can handle rename across FSGH-73991: Add pathlib.Path.move that can handle rename across FSApr 14, 2023
@barneygale

Copy link
Copy Markdown
Contributor

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

@oz123

Copy link
Copy Markdown
ContributorAuthor

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

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.

7 participants

@oz123@barneygale@MaxwellDupre@brettcannon@the-knights-who-say-ni@ezio-melotti@bedevere-bot