René's URL Explorer Experiment


Title: bpo-24132: Add direct subclassing of PurePath/Path in pathlib by kfollstad · Pull Request #26906 · python/cpython · GitHub

Open Graph Title: bpo-24132: Add direct subclassing of PurePath/Path in pathlib by kfollstad · Pull Request #26906 · python/cpython

X Title: bpo-24132: Add direct subclassing of PurePath/Path in pathlib by kfollstad · Pull Request #26906 · python/cpython

Description: I submit for your consideration a new working version (with documentation) of an extensible, subclassable PurePath/Path to close bpo-24132, a 6-year-old bug. I had previously submitted a PR which added classes to pathlib as a path to solving this, but these commits introduce no new public classes, breaking changes, or deviations from PEP 428. The crux of the issue here is that Path (and PurePath) are factories which generate their subclasses upon instantiation and as such are actually dependent upon their flavoured subclasses. To get around this, we attach _flavour to PurePath/Path (and any non PurePosixPath/PureWindowsPath/PosixPath/WindowsPath class) at time of instantiation. Then any subclass will have the essential _flavour attribute available to it. Moreover, in the case that the class being instantiated is PurePath/Path, instead of instantiating another new instance, we just update the class attributes in place so that it becomes its flavoured subclass. My thanks goes out to Barney Gale for making suggestions that inspired this approach. In addition, I should mention that @barneygale is working on implementing an AbstractPath interface which will allow for even further extensibility of pathlib. His idea thread on this is here. This was an active consideration as I was writing this, and I specifically chose an implementation which I think works with what he is doing. (Barney, I hope that you find that this to be true - I look forward to your comments.) To verify this, I created a stub version of AbstractPath derived from these commits which I hope further shows the viability of this approach. That code can be found here. https://bugs.python.org/issue24132

Open Graph Description: I submit for your consideration a new working version (with documentation) of an extensible, subclassable PurePath/Path to close bpo-24132, a 6-year-old bug. I had previously submitted a PR which a...

X Description: I submit for your consideration a new working version (with documentation) of an extensible, subclassable PurePath/Path to close bpo-24132, a 6-year-old bug. I had previously submitted a PR which a...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:acf4a2d1-c30a-500d-02f3-a32d019aae14
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD686:358448:49E999:6815AB:696A4728
html-safe-nonce560603c9d0378efb9c94321647a96990f9f7b29f852cd752ffa1d7722659d338
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjg2OjM1ODQ0ODo0OUU5OTk6NjgxNUFCOjY5NkE0NzI4IiwidmlzaXRvcl9pZCI6IjI1MTY0NTUxMDc1Mjc4NTM4NjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac043a6a863a525f1a3ff81f7f7d13da73df73b408f7eb4bc0d76cd1e466db4946
hovercard-subject-tagpull_request:677493861
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/26906/files
twitter:imagehttps://avatars.githubusercontent.com/u/24860864?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/24860864?s=400&v=4
og:image:altI submit for your consideration a new working version (with documentation) of an extensible, subclassable PurePath/Path to close bpo-24132, a 6-year-old bug. I had previously submitted a PR which a...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None3f871c8e07f0ae1886fa8dac284166d28b09ad5bada6476fc10b674e489788ef
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
release63c426b30d262aba269ef14c40e3c817b384cd61
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/26906/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F26906%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%2F26906%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/26906/files
Reloadhttps://github.com/python/cpython/pull/26906/files
Reloadhttps://github.com/python/cpython/pull/26906/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/26906/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/26906/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
kfollstadhttps://github.com/kfollstad
python:mainhttps://github.com/python/cpython/tree/main
kfollstad:PathlibFinalMasqueradehttps://github.com/kfollstad/cpython/tree/PathlibFinalMasquerade
Conversation 8 https://github.com/python/cpython/pull/26906
Commits 7 https://github.com/python/cpython/pull/26906/commits
Checks 0 https://github.com/python/cpython/pull/26906/checks
Files changed https://github.com/python/cpython/pull/26906/files
Please reload this pagehttps://github.com/python/cpython/pull/26906/files
bpo-24132: Add direct subclassing of PurePath/Path in pathlib https://github.com/python/cpython/pull/26906/files#top
Show all changes 7 commits https://github.com/python/cpython/pull/26906/files
710f577 bpo-24132: Add tests for class properties in pathlib's PurePath/Path kfollstad Jun 11, 2021 https://github.com/python/cpython/pull/26906/commits/710f5778302dbe4363a0e9a8b187275d6c1bc47c
a373969 bpo-24132: Add test for direct subclassing of PurePath/Path in pathlib kfollstad Jun 14, 2021 https://github.com/python/cpython/pull/26906/commits/a373969d084b89b60cf34bbe32becd1fec9e8707
35d8f78 bpo-24132: Fix inconsistent organization of is_mount in pathlib kfollstad May 27, 2021 https://github.com/python/cpython/pull/26906/commits/35d8f789fad64674a7c7d254f2d5808049f0e504
bab67b4 bpo-24132: Replace additional hardcoded references in pathlib kfollstad May 3, 2021 https://github.com/python/cpython/pull/26906/commits/bab67b412ebe5b9283dc85326abf1c396ca1232b
67faae0 bpo-24132: Replace factory functionality with masquerade in pathlib kfollstad Jun 14, 2021 https://github.com/python/cpython/pull/26906/commits/67faae045e7b95ffe1d4ccb742b5cd4006145dd0
610f41e bpo-24132: Add tests for comparing subclasses of PurePath in pathlib kfollstad Jun 17, 2021 https://github.com/python/cpython/pull/26906/commits/610f41ed81e96b525b6ac230117527255e79b73d
a0c4998 bpo-24132: Document direct subclassing of PurePath/Path in pathlib kfollstad Jun 16, 2021 https://github.com/python/cpython/pull/26906/commits/a0c4998ffd2fdb32aa8901a7ba872a4d9ddaabba
Clear filters https://github.com/python/cpython/pull/26906/files
Please reload this pagehttps://github.com/python/cpython/pull/26906/files
Please reload this pagehttps://github.com/python/cpython/pull/26906/files
conf.py https://github.com/python/cpython/pull/26906/files#diff-bd848f922db8b27516214e75f544d03f48a19eeebfe2509341a7c18e0a115c8c
pathlib.rst https://github.com/python/cpython/pull/26906/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
pathlib.py https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
test_pathlib.py https://github.com/python/cpython/pull/26906/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
ACKS https://github.com/python/cpython/pull/26906/files#diff-d1243956feb505c5459fc05387e194609efb5c350cee202942be47ed30d7d7d0
2021-06-16-17-38-36.bpo-24132.FqsJWY.rst https://github.com/python/cpython/pull/26906/files#diff-eefb149b7ec6d39a6a8f2783045e9fd1a0eb5f8fe2ea11f617fc0253c109472b
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L104
Doc/conf.pyhttps://github.com/python/cpython/pull/26906/files#diff-bd848f922db8b27516214e75f544d03f48a19eeebfe2509341a7c18e0a115c8c
View file https://github.com/kfollstad/cpython/blob/a0c4998ffd2fdb32aa8901a7ba872a4d9ddaabba/Doc/conf.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/26906/{{ revealButtonHref }}
https://github.com/python/cpython/pull/26906/files#diff-bd848f922db8b27516214e75f544d03f48a19eeebfe2509341a7c18e0a115c8c
kfollstadhttps://github.com/kfollstad
Jun 25, 2021https://github.com/python/cpython/pull/26906/files#r658995601
Please reload this pagehttps://github.com/python/cpython/pull/26906/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/26906/files
merwokhttps://github.com/merwok
Jan 5, 2022https://github.com/python/cpython/pull/26906/files#r778499552
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/26906/files
https://github.com/python/cpython/pull/26906/files#diff-bd848f922db8b27516214e75f544d03f48a19eeebfe2509341a7c18e0a115c8c
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L525
Doc/library/pathlib.rsthttps://github.com/python/cpython/pull/26906/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
View file https://github.com/kfollstad/cpython/blob/a0c4998ffd2fdb32aa8901a7ba872a4d9ddaabba/Doc/library/pathlib.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/26906/{{ revealButtonHref }}
https://github.com/python/cpython/pull/26906/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
https://github.com/python/cpython/pull/26906/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
https://github.com/python/cpython/pull/26906/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
merwokhttps://github.com/merwok
Jan 5, 2022https://github.com/python/cpython/pull/26906/files#r778499893
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/26906/files
merwokhttps://github.com/merwok
Jan 5, 2022https://github.com/python/cpython/pull/26906/files#r778500656
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/26906/files
https://github.com/python/cpython/pull/26906/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
Lib/pathlib.pyhttps://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
View file https://github.com/kfollstad/cpython/blob/a0c4998ffd2fdb32aa8901a7ba872a4d9ddaabba/Lib/pathlib.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/26906/{{ revealButtonHref }}
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/26906/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
Please reload this pagehttps://github.com/python/cpython/pull/26906/files
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.