René's URL Explorer Experiment


Title: gh-84538: add strict argument to pathlib.PurePath.relative_to by domragusa · Pull Request #19813 · python/cpython · GitHub

Open Graph Title: gh-84538: add strict argument to pathlib.PurePath.relative_to by domragusa · Pull Request #19813 · python/cpython

X Title: gh-84538: add strict argument to pathlib.PurePath.relative_to by domragusa · Pull Request #19813 · python/cpython

Description: By default, :meth:pathlib.PurePath.relative_to doesn't deal with paths that are not a direct prefix of the other, raising an exception in that instance. This change adds a walk_up parameter that can be set to allow for using .. to calculate the relative path. example: >>> p = PurePosixPath('/etc/passwd') >>> p.relative_to('/etc') PurePosixPath('passwd') >>> p.relative_to('/usr') Traceback (most recent call last): File "", line 1, in File "pathlib.py", line 940, in relative_to raise ValueError(error_message.format(str(self), str(formatted))) ValueError: '/etc/passwd' does not start with '/usr' >>> p.relative_to('/usr', strict=False) PurePosixPath('../etc/passwd') https://bugs.python.org/issue40358 Automerge-Triggered-By: GH:brettcannon Issue: gh-84538

Open Graph Description: By default, :meth:pathlib.PurePath.relative_to doesn't deal with paths that are not a direct prefix of the other, raising an exception in that instance. This change adds a walk_up parameter tha...

X Description: By default, :meth:pathlib.PurePath.relative_to doesn't deal with paths that are not a direct prefix of the other, raising an exception in that instance. This change adds a walk_up parameter...

Opengraph URL: https://github.com/python/cpython/pull/19813

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:20a9e922-ee48-9221-4a81-4ef6dfe530e1
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDD06:1F9980:19B5FA1:226D47A:6969ADFE
html-safe-nonce36cff2bcb58a0244ade1d24d1999f904b5fa3d69f1500ca7844bb4215795553e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDA2OjFGOTk4MDoxOUI1RkExOjIyNkQ0N0E6Njk2OUFERkUiLCJ2aXNpdG9yX2lkIjoiMjkyODQzNjU3ODI0MjYzNzMxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac097723f8d09833939b798940e9a82b8b820f1f729cf1cbf77b562f92189eaba5
hovercard-subject-tagpull_request:411326870
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/19813/files
twitter:imagehttps://avatars.githubusercontent.com/u/64558788?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/64558788?s=400&v=4
og:image:altBy default, :meth:pathlib.PurePath.relative_to doesn't deal with paths that are not a direct prefix of the other, raising an exception in that instance. This change adds a walk_up parameter tha...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None24c4c97a2d520cb286b35e1a4c22d7a4df3c26a2fa28dd7cdf0e65db327b4de7
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release124667f43168afb6c9c03b7c02eb5b1d2e1be3d9
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/19813/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F19813%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F19813%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/19813/files
Reloadhttps://github.com/python/cpython/pull/19813/files
Reloadhttps://github.com/python/cpython/pull/19813/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/19813/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/pull/19813/files
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
miss-islingtonhttps://github.com/miss-islington
python:mainhttps://github.com/python/cpython/tree/main
domragusa:relative_to_strict_paramhttps://github.com/domragusa/cpython/tree/relative_to_strict_param
Conversation 45 https://github.com/python/cpython/pull/19813
Commits 17 https://github.com/python/cpython/pull/19813/commits
Checks 0 https://github.com/python/cpython/pull/19813/checks
Files changed https://github.com/python/cpython/pull/19813/files
Please reload this pagehttps://github.com/python/cpython/pull/19813/files
gh-84538: add strict argument to pathlib.PurePath.relative_to https://github.com/python/cpython/pull/19813/files#top
Show all changes 17 commits https://github.com/python/cpython/pull/19813/files
ec64368 bpo-40358: add strict param to pathlib.PurePath.relative_to domragusa Apr 30, 2020 https://github.com/python/cpython/pull/19813/commits/ec643681ce35ad01f84986dc935ad7787b62f2b4
6d721a0 resolve conflicts with GH-19611 domragusa May 28, 2020 https://github.com/python/cpython/pull/19813/commits/6d721a0ee1fbc841fd555d3acf173f56f36ba410
09422e7 Merge branch 'python:main' into relative_to_strict_param domragusa May 15, 2021 https://github.com/python/cpython/pull/19813/commits/09422e77a9f78f90f4339ba0235414a68d14dc35
d9c07c2 Update Doc/library/pathlib.rst domragusa May 15, 2021 https://github.com/python/cpython/pull/19813/commits/d9c07c2f0f73dcf5c7dc863f9d4eeaeb3cfe64c4
029c3d5 fix wording in documentation as requested domragusa May 17, 2021 https://github.com/python/cpython/pull/19813/commits/029c3d5ce9acb7dc1bfc8e2b9cce1e0e54cc0b51
01e789b fix typo domragusa May 17, 2021 https://github.com/python/cpython/pull/19813/commits/01e789b0e9493c45745865419203749f3920a0f5
39b24f3 change strict argument to walk_up in pathlib.PurePath.relative_to domragusa May 29, 2021 https://github.com/python/cpython/pull/19813/commits/39b24f3bc17010d930f3572c98635730fb085466
ad9c0dd Merge branch 'main' into relative_to_strict_param domragusa Oct 14, 2022 https://github.com/python/cpython/pull/19813/commits/ad9c0ddea49275bdd90241a8f9a66e6b768519e8
8401974 make the documentation clearer domragusa Oct 14, 2022 https://github.com/python/cpython/pull/19813/commits/8401974d96fdbc035162eaddf49e903e96ecc979
e255f99 Apply suggestions from code review domragusa Oct 22, 2022 https://github.com/python/cpython/pull/19813/commits/e255f99c8cedf21212988f1ca3d1a52bb1d6304d
b781356 Update Lib/pathlib.py domragusa Oct 22, 2022 https://github.com/python/cpython/pull/19813/commits/b7813562abff8f0af8b56c5dd110d209cc817312
7974ee9 fix doc warning domragusa Oct 22, 2022 https://github.com/python/cpython/pull/19813/commits/7974ee93be5aae33e0719615c69ff10df71d69b7
8a4edb5 improve variable names domragusa Oct 22, 2022 https://github.com/python/cpython/pull/19813/commits/8a4edb5dac97c6c076d31ebebc8a3bbc1466e4c0
e6cf222 remove trailing spaces domragusa Oct 22, 2022 https://github.com/python/cpython/pull/19813/commits/e6cf222257b744a714ed3ab438da833e0ab2da0d
b8b218c Merge branch 'main' into relative_to_strict_param domragusa Oct 22, 2022 https://github.com/python/cpython/pull/19813/commits/b8b218c902362cab5ca65ff117fa6f5973311789
a4c77c2 Update Doc/library/pathlib.rst brettcannon Oct 28, 2022 https://github.com/python/cpython/pull/19813/commits/a4c77c2fbb6d7094b1e0b0d6443eb4a4c68edbc4
97a5e22 Merge branch 'main' into relative_to_strict_param brettcannon Oct 28, 2022 https://github.com/python/cpython/pull/19813/commits/97a5e228e92510ada2e0734426419dc6d6d2b366
Clear filters https://github.com/python/cpython/pull/19813/files
Please reload this pagehttps://github.com/python/cpython/pull/19813/files
Please reload this pagehttps://github.com/python/cpython/pull/19813/files
pathlib.rst https://github.com/python/cpython/pull/19813/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
3.12.rst https://github.com/python/cpython/pull/19813/files#diff-0f2c1763c64530268325a0ee2dfaa4f5d555c4ac27deb78bd77102c8ce1b886b
pathlib.py https://github.com/python/cpython/pull/19813/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
test_pathlib.py https://github.com/python/cpython/pull/19813/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
ACKS https://github.com/python/cpython/pull/19813/files#diff-d1243956feb505c5459fc05387e194609efb5c350cee202942be47ed30d7d7d0
2020-04-30-02-15-08.bpo-40358.A4ygqe.rst https://github.com/python/cpython/pull/19813/files#diff-a6eeb8773189ed36054c2c09b047c18d2c93a561fb68dad893858bb7663b0423
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L525
Doc/library/pathlib.rsthttps://github.com/python/cpython/pull/19813/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
View file https://github.com/domragusa/cpython/blob/97a5e228e92510ada2e0734426419dc6d6d2b366/Doc/library/pathlib.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19813/{{ revealButtonHref }}
https://github.com/python/cpython/pull/19813/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
https://github.com/python/cpython/pull/19813/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
https://github.com/python/cpython/pull/19813/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L114
Doc/whatsnew/3.12.rsthttps://github.com/python/cpython/pull/19813/files#diff-0f2c1763c64530268325a0ee2dfaa4f5d555c4ac27deb78bd77102c8ce1b886b
View file https://github.com/domragusa/cpython/blob/97a5e228e92510ada2e0734426419dc6d6d2b366/Doc/whatsnew/3.12.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19813/{{ revealButtonHref }}
https://github.com/python/cpython/pull/19813/files#diff-0f2c1763c64530268325a0ee2dfaa4f5d555c4ac27deb78bd77102c8ce1b886b
https://github.com/python/cpython/pull/19813/files#diff-0f2c1763c64530268325a0ee2dfaa4f5d555c4ac27deb78bd77102c8ce1b886b
Lib/pathlib.pyhttps://github.com/python/cpython/pull/19813/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
View file https://github.com/domragusa/cpython/blob/97a5e228e92510ada2e0734426419dc6d6d2b366/Lib/pathlib.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19813/{{ revealButtonHref }}
https://github.com/python/cpython/pull/19813/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
Please reload this pagehttps://github.com/python/cpython/pull/19813/files
https://github.com/python/cpython/pull/19813/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
Please reload this pagehttps://github.com/python/cpython/pull/19813/files
https://github.com/python/cpython/pull/19813/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
Lib/test/test_pathlib.pyhttps://github.com/python/cpython/pull/19813/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
View file https://github.com/domragusa/cpython/blob/97a5e228e92510ada2e0734426419dc6d6d2b366/Lib/test/test_pathlib.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19813/{{ revealButtonHref }}
https://github.com/python/cpython/pull/19813/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
https://github.com/python/cpython/pull/19813/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
https://github.com/python/cpython/pull/19813/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
https://github.com/python/cpython/pull/19813/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
https://github.com/python/cpython/pull/19813/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
https://github.com/python/cpython/pull/19813/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
https://github.com/python/cpython/pull/19813/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
https://github.com/python/cpython/pull/19813/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
https://github.com/python/cpython/pull/19813/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
Misc/ACKShttps://github.com/python/cpython/pull/19813/files#diff-d1243956feb505c5459fc05387e194609efb5c350cee202942be47ed30d7d7d0
View file https://github.com/domragusa/cpython/blob/97a5e228e92510ada2e0734426419dc6d6d2b366/Misc/ACKS
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19813/{{ revealButtonHref }}
https://github.com/python/cpython/pull/19813/files#diff-d1243956feb505c5459fc05387e194609efb5c350cee202942be47ed30d7d7d0
https://github.com/python/cpython/pull/19813/files#diff-d1243956feb505c5459fc05387e194609efb5c350cee202942be47ed30d7d7d0
Misc/NEWS.d/next/Library/2020-04-30-02-15-08.bpo-40358.A4ygqe.rsthttps://github.com/python/cpython/pull/19813/files#diff-a6eeb8773189ed36054c2c09b047c18d2c93a561fb68dad893858bb7663b0423
View file https://github.com/domragusa/cpython/blob/97a5e228e92510ada2e0734426419dc6d6d2b366/Misc/NEWS.d/next/Library/2020-04-30-02-15-08.bpo-40358.A4ygqe.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/19813/{{ revealButtonHref }}
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.