René's URL Explorer Experiment


Title: importlib.resources regression for custom ResourceReader · Issue #127337 · python/cpython · GitHub

Open Graph Title: importlib.resources regression for custom ResourceReader · Issue #127337 · python/cpython

X Title: importlib.resources regression for custom ResourceReader · Issue #127337 · python/cpython

Description: Since Python 3.13 (including 3.14), my custom ResourceReader is now raising errors when used with importlib.resources.contents. This code is otherwise functioning fine from 3.8 onwards. Traceback (most recent call last): File "D:\cpython...

Open Graph Description: Since Python 3.13 (including 3.14), my custom ResourceReader is now raising errors when used with importlib.resources.contents. This code is otherwise functioning fine from 3.8 onwards. Traceback (...

X Description: Since Python 3.13 (including 3.14), my custom ResourceReader is now raising errors when used with importlib.resources.contents. This code is otherwise functioning fine from 3.8 onwards. Traceback (...

Opengraph URL: https://github.com/python/cpython/issues/127337

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"importlib.resources regression for custom ResourceReader","articleBody":"Since Python 3.13 (including 3.14), my custom ResourceReader is now raising errors when used with `importlib.resources.contents`. This code is otherwise functioning fine from 3.8 onwards.\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"D:\\cpython\\t.py\", line 41, in \u003cmodule>\r\n    print(contents(FakeModule))\r\n          ~~~~~~~~^^^^^^^^^^^^\r\n  File \"D:\\cpython\\Lib\\importlib\\resources\\_functional.py\", line 60, in contents\r\n    return (resource.name for resource in _get_resource(anchor, path_names).iterdir())\r\n                                          ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^\r\n  File \"D:\\cpython\\Lib\\importlib\\resources\\_functional.py\", line 81, in _get_resource\r\n    return files(anchor).joinpath(*path_names)\r\n           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^\r\nTypeError: CompatibilityFiles.SpecPath.joinpath() missing 1 required positional argument: 'other'\r\n```\r\n\r\nSelf-contained repro below (the real one gets compiled into DLLs, so you don't want to try to debug it ;) ):\r\n\r\n```python\r\nfrom importlib.abc import Loader\r\nfrom importlib.machinery import ModuleSpec\r\nfrom importlib.resources.abc import ResourceReader\r\n\r\n_DATA = {\"FakeModule.NAME\": b\"hello\"}\r\n_DATA_NAMES = set(_DATA)\r\n\r\nclass MyReader(ResourceReader):\r\n    def __init__(self, prefix):\r\n        self.prefix = prefix\r\n\r\n    def open_resource(self, resource):\r\n        import io\r\n        return io.BytesIO(_DATA[self.prefix + resource])\r\n\r\n    def resource_path(self, resource):\r\n        raise FileNotFoundError()\r\n\r\n    def is_resource(self, resource):\r\n        return self.prefix + resource in _DATA_NAMES\r\n\r\n    def contents(self):\r\n        p = self.prefix\r\n        lp = len(p)\r\n        return (n[lp:] for n in _DATA_NAMES if n.startswith(p))\r\n\r\nclass MyLoader(Loader):\r\n    create_module = ...\r\n    exec_module = ...\r\n\r\n    def get_resource_reader(self, fullname):\r\n        return MyReader(fullname + \".\")\r\n\r\nclass FakeModule:\r\n    __loader__ = MyLoader()\r\n    __name__ = \"FakeModule\"\r\n    __spec__ = ModuleSpec(__name__, __loader__)\r\n\r\nfrom importlib.resources import contents\r\nprint(contents(FakeModule))\r\n```\r\n\r\n(ping @jaraco)\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-154919\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/zooba","@type":"Person","name":"zooba"},"datePublished":"2024-11-27T15:42:03Z","url":"https://github.com/python/cpython/issues/127337"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:3acb463f-e681-75df-761c-5c411ea464bd
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8D9C:177D5B:35565D9:46C368D:6B004244
html-safe-nonce0c59edaf736a5fbb60239a05c75abf8f6d400adc26f2a8e3c97c56f3c056109b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDlDOjE3N0Q1QjozNTU2NUQ5OjQ2QzM2OEQ6NkIwMDQyNDQiLCJ2aXNpdG9yX2lkIjoiNzM1NDgzMjg0NTY0NDI1MTcxNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac7c3c7f5bdc444145bc50e655f2da640e7816b5fa8c16ccf7dbaa550266807314
hovercard-subject-tagissue:2698999968
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/127337/issue_layout
twitter:imagehttps://opengraph.githubassets.com/9c27bda45ae72fdc322f9be34bfabdffb79b97ae7ff6963e25b1fcd7852b9614/python/cpython/issues/127337
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/9c27bda45ae72fdc322f9be34bfabdffb79b97ae7ff6963e25b1fcd7852b9614/python/cpython/issues/127337
og:image:altSince Python 3.13 (including 3.14), my custom ResourceReader is now raising errors when used with importlib.resources.contents. This code is otherwise functioning fine from 3.8 onwards. Traceback (...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamezooba
hostnamegithub.com
expected-hostnamegithub.com
None7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef3f3a43ca095cdea3abbb394112e971f9fdb94fa
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/127337#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F127337
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F127337
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/127337
Reloadhttps://github.com/python/cpython/issues/127337
Reloadhttps://github.com/python/cpython/issues/127337
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/127337
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/127337
importlib.resources regression for custom ResourceReaderhttps://github.com/python/cpython/issues/127337#top
https://github.com/FFY00
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
topic-importlibhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-importlib%22
https://github.com/zooba
zoobahttps://github.com/zooba
on Nov 27, 2024https://github.com/python/cpython/issues/127337#issue-2698999968
@jaracohttps://github.com/jaraco
gh-127337: Fix importlib.resources for legacy ResourceReader loaders #154919https://github.com/python/cpython/pull/154919
zoobahttps://github.com/zooba
topic-importlibhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-importlib%22
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
on Nov 27, 2024https://github.com/python/cpython/issues/127337#event-15454561869
https://github.com/FFY00
FFY00https://github.com/FFY00
on Dec 1, 2024https://github.com/python/cpython/issues/127337#issuecomment-2509765048
python/importlib_resources#303https://github.com/python/importlib_resources/pull/303
https://github.com/python/importlib_resources/pull/282/fileshttps://github.com/python/importlib_resources/pull/282/files
python/importlib_resources#239https://github.com/python/importlib_resources/pull/239
GH-91623https://github.com/python/cpython/pull/91623
GH-91623https://github.com/python/cpython/pull/91623
picnixzhttps://github.com/picnixz
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
on Dec 1, 2024https://github.com/python/cpython/issues/127337#event-15484368891
https://github.com/jaraco
jaracohttps://github.com/jaraco
on Dec 1, 2024https://github.com/python/cpython/issues/127337#issuecomment-2510234681
python/importlib_resources#248https://github.com/python/importlib_resources/pull/248
GH-91298https://github.com/python/cpython/issues/91298
@encukouhttps://github.com/encukou
@FFY00https://github.com/FFY00
GH-91623https://github.com/python/cpython/pull/91623
jaracohttps://github.com/jaraco
FFY00https://github.com/FFY00
on Dec 1, 2024https://github.com/python/cpython/issues/127337#event-15485227903
https://github.com/zooba
zoobahttps://github.com/zooba
on Dec 2, 2024https://github.com/python/cpython/issues/127337#issuecomment-2511406101
pikammmmmhttps://github.com/pikammmmm
on Nov 11, 2026https://github.com/python/cpython/issues/127337#event-35847626362
Merge remote-tracking branch 'upstream/main' into pythongh-127337-com…https://github.com/pikammmmm/cpython/commit/3e6bc1ea1f20083a92ad056cb3b26b59c2f3f02a
pythongh-127337https://github.com/python/cpython/issues/127337
3e6bc1ehttps://github.com/pikammmmm/cpython/commit/3e6bc1ea1f20083a92ad056cb3b26b59c2f3f02a
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/127337
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/127337
FFY00https://github.com/FFY00
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
topic-importlibhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-importlib%22
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.