Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-94909: fix joining of absolute and relative Windows paths in pathlib#95450

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@barneygale
Copy link
Contributor

@barneygalebarneygale commentedJul 29, 2022
edited by miss-islington
Loading

Have pathlib useos.path.join() to join arguments to thePurePath initialiser, which fixes a minor bug when handling relative paths with drives.

Previously:

>>>frompathlibimportPureWindowsPath>>>a='C:/a/b'>>>b='C:x/y'>>>PureWindowsPath(a,b)PureWindowsPath('C:x/y')

Now:

>>>PureWindowsPath(a,b)PureWindowsPath('C:/a/b/x/y')

Automerge-Triggered-By: GH:brettcannon

@barneygale
Copy link
ContributorAuthor

Hey@serhiy-storchaka, would you be willing to review? You fixed the same issue injoinpath() (#64107) almost a decade ago! Thanks.

@brettcannonbrettcannon added needs backport to 3.10only security fixes needs backport to 3.11only security fixes labelsAug 5, 2022
@brettcannon
Copy link
Member

@barneygale if@serhiy-storchaka doesn't review in a week I will go ahead and merge; feel free to ping me to do it if I forget (I'm also stalling because 3.11.0.rc1 is being cut today and I don't want to have to remember to merge into 3.11 once the branch opens again and then forget). 😅

barneygale reacted with thumbs up emoji

@brettcannonbrettcannon linked an issueAug 5, 2022 that may beclosed by this pull request
Co-authored-by: Brett Cannon <brett@python.org>
@serhiy-storchaka
Copy link
Member

Wait a moment. This change goes against the initial approach. It can be slower and inconsistent with other pathlib code (the definition of "drive" was different in pathlib and os.path, and can still be different).

@barneygale
Copy link
ContributorAuthor

Could you give an example where its inconsistent with other parts of pathlib?

It might be slower (I haven't checked) but I don't think pathlib, as ahigh level path library, should care about beating the performance ofos.path for equivalent operations. Comparable performance is fine.

encukou reacted with thumbs up emoji

@barneygale
Copy link
ContributorAuthor

We could de-risk this by skipping backporting. It's a niche bug, and I only need it solved inmain.

@brettcannonbrettcannon added 🤖 automerge and removed needs backport to 3.10only security fixes needs backport to 3.11only security fixes labelsAug 12, 2022
@miss-islingtonmiss-islington merged commit187949e intopython:mainAug 12, 2022
@brettcannon
Copy link
Member

To keep things simple I only did this tomain. We can always backport later if we find it necessary.

barneygale reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@brettcannonbrettcannonbrettcannon approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

pathlib: inconsistent handling of rootless Windows paths

5 participants

@barneygale@brettcannon@serhiy-storchaka@bedevere-bot@miss-islington

[8]ページ先頭

©2009-2025 Movatter.jp