René's URL Explorer Experiment


Title: bpo-32303: Consistency fixes for namespace loaders by warsaw · Pull Request #5481 · python/cpython · GitHub

Open Graph Title: bpo-32303: Consistency fixes for namespace loaders by warsaw · Pull Request #5481 · python/cpython

X Title: bpo-32303: Consistency fixes for namespace loaders by warsaw · Pull Request #5481 · python/cpython

Description: This branch actually fixes two inconsistencies for namespace package loaders. Namespace packages have inconsistent __loader__ and __spec__.loader. This inconsistency leads to namespace packages having a valid __loader__ but None for __spec__.loader. This branch fixes it by ensuring that the two attributes start out the same. (As always, a user could change one or the other, and no attempt is made by Python to keep them in sync.) Namespace packages have inconsistent __file__ and __spec__.origin. Here, namespace packages have a __spec__.origin that is the literal string "namespace", and they do not have a __file__ attribute. Not only is this inconsistent, I believe it violates the documentation. The fix here is to set both __spec__.origin and __file__ to None for namespace packages. I suppose it's possible that this will break existing code, but I'd argue that because current behavior runs counter to the documentation and makes no sense given the inconsistencies, it is better to fix them. I propose this change be applied to 3.7 and 3.6, although if you, my friendly reviewer, disagrees about 3.6, we can talk about it! This isn't a security issue to back porting to 3.5 is off the table. https://bugs.python.org/issue32303

Open Graph Description: This branch actually fixes two inconsistencies for namespace package loaders. Namespace packages have inconsistent __loader__ and __spec__.loader. This inconsistency leads to namespace packages h...

X Description: This branch actually fixes two inconsistencies for namespace package loaders. Namespace packages have inconsistent __loader__ and __spec__.loader. This inconsistency leads to namespace packages h...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:4ccc1453-8e17-92c7-7fc7-123ff61bc445
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCF80:179658:738568:AABAD6:6A4E13DF
html-safe-nonce32e28ff49e2e4b02b919b06a600cd808a70b3afcea3d461941eca1d6e0abd22d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRjgwOjE3OTY1ODo3Mzg1Njg6QUFCQUQ2OjZBNEUxM0RGIiwidmlzaXRvcl9pZCI6IjMwMTA5NDMxODM0ODE2MDcxMzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac339d0a7da541e79c3ffad4f3d5ed9225af6557778a781134103846e0a713be30
hovercard-subject-tagpull_request:166640441
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/5481/files
twitter:imagehttps://avatars.githubusercontent.com/u/210184?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/210184?s=400&v=4
og:image:altThis branch actually fixes two inconsistencies for namespace package loaders. Namespace packages have inconsistent __loader__ and __spec__.loader. This inconsistency leads to namespace packages h...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0
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
releaseea9187571e3edc5f2780f750631138669441ca50
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/5481/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F5481%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
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
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
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%2F5481%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/5481/files
Reloadhttps://github.com/python/cpython/pull/5481/files
Reloadhttps://github.com/python/cpython/pull/5481/files
Please reload this pagehttps://github.com/python/cpython/pull/5481/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/5481/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 34.8k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.6k 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.3k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality 0 https://github.com/python/cpython/security
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 and quality 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
warsawhttps://github.com/warsaw
python:masterhttps://github.com/python/cpython/tree/master
warsaw:nsloaderhttps://github.com/warsaw/cpython/tree/nsloader
Conversation 8 https://github.com/python/cpython/pull/5481
Commits 5 https://github.com/python/cpython/pull/5481/commits
Checks 0 https://github.com/python/cpython/pull/5481/checks
Files changed https://github.com/python/cpython/pull/5481/files
Please reload this pagehttps://github.com/python/cpython/pull/5481/files
bpo-32303: Consistency fixes for namespace loaders https://github.com/python/cpython/pull/5481/files#top
Show all changes 5 commits https://github.com/python/cpython/pull/5481/files
1c5a7b0 Make sure ``__spec__.loader`` matches ``__loader__`` for namespace pa… warsaw Feb 1, 2018 https://github.com/python/cpython/pull/5481/commits/1c5a7b0febace74c9c5d75a6446e3bd07796675e
24ad3ef Update the documentation warsaw Feb 1, 2018 https://github.com/python/cpython/pull/5481/commits/24ad3efb1fb2403a477dc986e7ecc09caf247e59
acaba0d Factor out the check for origin and has_location. warsaw Feb 1, 2018 https://github.com/python/cpython/pull/5481/commits/acaba0d01e77dc7cef9d94d035379cbbae48171e
ad9a78d Merge branch 'master' into nsloader warsaw Feb 2, 2018 https://github.com/python/cpython/pull/5481/commits/ad9a78d518cfd481ac77f139b58ef70069266e20
cd4c4ec Respond to review comments. warsaw Feb 2, 2018 https://github.com/python/cpython/pull/5481/commits/cd4c4ecad89b16580cfc0c0baa77922fc70229b5
Clear filters https://github.com/python/cpython/pull/5481/files
Please reload this pagehttps://github.com/python/cpython/pull/5481/files
Please reload this pagehttps://github.com/python/cpython/pull/5481/files
importlib.rst https://github.com/python/cpython/pull/5481/files#diff-023b9cd2ff76dd1b2a7117a363f1789d5d192c09d632872934b86e8d3fbe5f3e
_bootstrap.py https://github.com/python/cpython/pull/5481/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
_bootstrap_external.py https://github.com/python/cpython/pull/5481/files#diff-efefe383b3a81d16150c280db0b64eed7569254299418f64cc0d749f8e16f3a4
resources.py https://github.com/python/cpython/pull/5481/files#diff-b5f6dc7e442a38699664db6f9be914f60cdfbd1ee1f97eff87a6b873bff4aaeb
test_api.py https://github.com/python/cpython/pull/5481/files#diff-32feba6e248d99038e204a25999575bb295ead3e3700847799026d4b88d065c6
test_namespace_pkgs.py https://github.com/python/cpython/pull/5481/files#diff-7eb0aefc85c412e2ee3c9a8093a6e8fa0256a99f26969aa02b2d81ee80f40c18
2018-02-01-10-16-28.bpo-32303.VsvhSl.rst https://github.com/python/cpython/pull/5481/files#diff-c30216df608a539f4bb81bb9930b042f478f7ac5af86b9c98a0ca42b494fd686
2018-02-01-10-56-41.bpo-32305.dkU9Qa.rst https://github.com/python/cpython/pull/5481/files#diff-fa2c287d27dabb58d5c13a75a80d28b0da829fc0149b595984549bc7ebf4c7c7
importlib.h https://github.com/python/cpython/pull/5481/files#diff-f22c3fe718474bf1830c047f516ef95818493a9a9fcf8f2d5b159b1b5b76ecd6
importlib_external.h https://github.com/python/cpython/pull/5481/files#diff-edaa85591e6f559d0fae8073b45dc3e9c8e251053d07623b2ce23392dfe97a7e
Doc/library/importlib.rsthttps://github.com/python/cpython/pull/5481/files#diff-023b9cd2ff76dd1b2a7117a363f1789d5d192c09d632872934b86e8d3fbe5f3e
View file https://github.com/warsaw/cpython/blob/cd4c4ecad89b16580cfc0c0baa77922fc70229b5/Doc/library/importlib.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/5481/{{ revealButtonHref }}
https://github.com/python/cpython/pull/5481/files#diff-023b9cd2ff76dd1b2a7117a363f1789d5d192c09d632872934b86e8d3fbe5f3e
https://github.com/python/cpython/pull/5481/files#diff-023b9cd2ff76dd1b2a7117a363f1789d5d192c09d632872934b86e8d3fbe5f3e
Lib/importlib/_bootstrap.pyhttps://github.com/python/cpython/pull/5481/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
View file https://github.com/warsaw/cpython/blob/cd4c4ecad89b16580cfc0c0baa77922fc70229b5/Lib/importlib/_bootstrap.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/5481/{{ revealButtonHref }}
https://github.com/python/cpython/pull/5481/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
https://github.com/python/cpython/pull/5481/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
Lib/importlib/_bootstrap_external.pyhttps://github.com/python/cpython/pull/5481/files#diff-efefe383b3a81d16150c280db0b64eed7569254299418f64cc0d749f8e16f3a4
View file https://github.com/warsaw/cpython/blob/cd4c4ecad89b16580cfc0c0baa77922fc70229b5/Lib/importlib/_bootstrap_external.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/5481/{{ revealButtonHref }}
https://github.com/python/cpython/pull/5481/files#diff-efefe383b3a81d16150c280db0b64eed7569254299418f64cc0d749f8e16f3a4
https://github.com/python/cpython/pull/5481/files#diff-efefe383b3a81d16150c280db0b64eed7569254299418f64cc0d749f8e16f3a4
Lib/importlib/resources.pyhttps://github.com/python/cpython/pull/5481/files#diff-b5f6dc7e442a38699664db6f9be914f60cdfbd1ee1f97eff87a6b873bff4aaeb
View file https://github.com/warsaw/cpython/blob/cd4c4ecad89b16580cfc0c0baa77922fc70229b5/Lib/importlib/resources.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/5481/{{ revealButtonHref }}
https://github.com/python/cpython/pull/5481/files#diff-b5f6dc7e442a38699664db6f9be914f60cdfbd1ee1f97eff87a6b873bff4aaeb
https://github.com/python/cpython/pull/5481/files#diff-b5f6dc7e442a38699664db6f9be914f60cdfbd1ee1f97eff87a6b873bff4aaeb
https://github.com/python/cpython/pull/5481/files#diff-b5f6dc7e442a38699664db6f9be914f60cdfbd1ee1f97eff87a6b873bff4aaeb
https://github.com/python/cpython/pull/5481/files#diff-b5f6dc7e442a38699664db6f9be914f60cdfbd1ee1f97eff87a6b873bff4aaeb
https://github.com/python/cpython/pull/5481/files#diff-b5f6dc7e442a38699664db6f9be914f60cdfbd1ee1f97eff87a6b873bff4aaeb
https://github.com/python/cpython/pull/5481/files#diff-b5f6dc7e442a38699664db6f9be914f60cdfbd1ee1f97eff87a6b873bff4aaeb
https://github.com/python/cpython/pull/5481/files#diff-b5f6dc7e442a38699664db6f9be914f60cdfbd1ee1f97eff87a6b873bff4aaeb
https://github.com/python/cpython/pull/5481/files#diff-b5f6dc7e442a38699664db6f9be914f60cdfbd1ee1f97eff87a6b873bff4aaeb
Lib/test/test_importlib/test_api.pyhttps://github.com/python/cpython/pull/5481/files#diff-32feba6e248d99038e204a25999575bb295ead3e3700847799026d4b88d065c6
View file https://github.com/warsaw/cpython/blob/cd4c4ecad89b16580cfc0c0baa77922fc70229b5/Lib/test/test_importlib/test_api.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/5481/{{ revealButtonHref }}
https://github.com/python/cpython/pull/5481/files#diff-32feba6e248d99038e204a25999575bb295ead3e3700847799026d4b88d065c6
https://github.com/python/cpython/pull/5481/files#diff-32feba6e248d99038e204a25999575bb295ead3e3700847799026d4b88d065c6
https://github.com/python/cpython/pull/5481/files#diff-32feba6e248d99038e204a25999575bb295ead3e3700847799026d4b88d065c6
Lib/test/test_importlib/test_namespace_pkgs.pyhttps://github.com/python/cpython/pull/5481/files#diff-7eb0aefc85c412e2ee3c9a8093a6e8fa0256a99f26969aa02b2d81ee80f40c18
View file https://github.com/warsaw/cpython/blob/cd4c4ecad89b16580cfc0c0baa77922fc70229b5/Lib/test/test_importlib/test_namespace_pkgs.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/5481/{{ revealButtonHref }}
https://github.com/python/cpython/pull/5481/files#diff-7eb0aefc85c412e2ee3c9a8093a6e8fa0256a99f26969aa02b2d81ee80f40c18
Misc/NEWS.d/next/Core and Builtins/2018-02-01-10-16-28.bpo-32303.VsvhSl.rsthttps://github.com/python/cpython/pull/5481/files#diff-c30216df608a539f4bb81bb9930b042f478f7ac5af86b9c98a0ca42b494fd686
View file https://github.com/warsaw/cpython/blob/cd4c4ecad89b16580cfc0c0baa77922fc70229b5/Misc/NEWS.d/next/Core%20and%20Builtins/2018-02-01-10-16-28.bpo-32303.VsvhSl.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/5481/{{ revealButtonHref }}
Misc/NEWS.d/next/Core and Builtins/2018-02-01-10-56-41.bpo-32305.dkU9Qa.rsthttps://github.com/python/cpython/pull/5481/files#diff-fa2c287d27dabb58d5c13a75a80d28b0da829fc0149b595984549bc7ebf4c7c7
View file https://github.com/warsaw/cpython/blob/cd4c4ecad89b16580cfc0c0baa77922fc70229b5/Misc/NEWS.d/next/Core%20and%20Builtins/2018-02-01-10-56-41.bpo-32305.dkU9Qa.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/5481/{{ revealButtonHref }}
Please reload this pagehttps://github.com/python/cpython/pull/5481/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.