Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add Path.copy_into for 3.14 #13998

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

Closed
wants to merge 9 commits into from

Conversation

max-muoto
Copy link
Contributor

@max-muoto max-muoto commented May 10, 2025

Adds copy_into for Path, there is some slightly interesting behavior around the fact in that if a destination that is a PurePath than than the path will return will match that class - otherwise type(self) is used. As a result, added a test to ensure we maintain this behavior.

@max-muoto max-muoto marked this pull request as draft May 10, 2025 21:07
@max-muoto max-muoto marked this pull request as ready for review May 10, 2025 21:10
@max-muoto max-muoto marked this pull request as draft May 10, 2025 21:18
@max-muoto max-muoto marked this pull request as ready for review May 10, 2025 21:23

pth = MyCustomPath.from_uri("file:///tmp/abc.txt")
# If the destination is a non-Path, it should default to a base Path.
Copy link
Member

Choose a reason for hiding this comment

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

This seems the opposite of the behavior the tests show.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, originally had different behavior until I corrected it - missed this comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This comment has been minimized.

@max-muoto max-muoto marked this pull request as draft May 10, 2025 21:37
@max-muoto
Copy link
Contributor Author

Moving back to draft until I can fix issues.

@JelleZijlstra
Copy link
Member

The mypy-primer diff is the opposite of #13985, very suspicious.

@max-muoto max-muoto force-pushed the add-pathlib-copy_into branch from 5e8d1bf to cf5969d Compare May 11, 2025 05:26
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@max-muoto max-muoto closed this May 11, 2025
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.

2 participants