René's URL Explorer Experiment


Title: `zipfile.Path.read_text` & `.open` methods with a positional `encoding` arg causes a TypeError · Issue #101144 · python/cpython · GitHub

Open Graph Title: `zipfile.Path.read_text` & `.open` methods with a positional `encoding` arg causes a TypeError · Issue #101144 · python/cpython

X Title: `zipfile.Path.read_text` & `.open` methods with a positional `encoding` arg causes a TypeError · Issue #101144 · python/cpython

Description: This is a regression from 3.9 behavior seen in Python 3.10. zipfile.Path.read_text passes *args and **kwargs to it's own open() method, but in 3.10+ is also blindly sets kwargs["encodings"] to a value. So code that was previously passing...

Open Graph Description: This is a regression from 3.9 behavior seen in Python 3.10. zipfile.Path.read_text passes *args and **kwargs to it's own open() method, but in 3.10+ is also blindly sets kwargs["encodings"] to a va...

X Description: This is a regression from 3.9 behavior seen in Python 3.10. zipfile.Path.read_text passes *args and **kwargs to it's own open() method, but in 3.10+ is also blindly sets kwargs["encodings&...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`zipfile.Path.read_text` \u0026 `.open` methods with a positional `encoding` arg causes a TypeError","articleBody":"This is a regression from 3.9 behavior seen in Python 3.10.\r\n\r\nzipfile.Path.read_text passes *args and **kwargs to it's own `open()` method, but in 3.10+ is also blindly sets `kwargs[\"encodings\"]` to a value. So code that was previously passing an encoding as a positional argument now sees:\r\n\r\n```\r\n  File \"/\u003cstdlib\u003e/zipfile.py\", line 2362, in read_text\r\n    with self.open('r', *args, **kwargs) as strm:\r\n  File \"/\u003cstdlib\u003e/zipfile.py\", line 2350, in open\r\n    return io.TextIOWrapper(stream, *args, **kwargs)\r\nTypeError: Failed to construct dataset imagenet2012: argument for TextIOWrapper() given by name ('encoding') and position (2)\r\n```\r\n\r\n3.10's Lib/zipfile.py (and main's Lib/zipfile/_path.py) contain:\r\n\r\n```\r\n    def read_text(self, *args, **kwargs):\r\n        kwargs[\"encoding\"] = io.text_encoding(kwargs.get(\"encoding\"))  # \u003c-- new in 3.10, source of bug\r\n        with self.open('r', *args, **kwargs) as strm:\r\n            return strm.read()\r\n```\r\n\r\nAs this is a regression, we should avoid setting that value in kwargs when `\"encodings\" not in kwargs` to match 3.9 and earlier behavior.\r\n\r\nTODO list:\r\n\r\n- [x] @jaraco will port the change to [zipp](/jaraco/zipp).\r\n\r\n\u003c!-- gh-linked-prs --\u003e\r\n### Linked PRs\r\n* gh-101145\r\n* gh-101179\r\n* gh-101182\r\n\u003c!-- /gh-linked-prs --\u003e\r\n","author":{"url":"https://github.com/gpshead","@type":"Person","name":"gpshead"},"datePublished":"2023-01-19T01:47:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/101144/cpython/issues/101144"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:57a6e70d-2683-a4b3-7d7c-f10f9d68d185
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE7DA:390ECE:4526957:61B432A:6A56C46E
html-safe-nonce1a44463004e89a6c729672d2212bf2b52972887366f531151ca20f6231bf5fb6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFN0RBOjM5MEVDRTo0NTI2OTU3OjYxQjQzMkE6NkE1NkM0NkUiLCJ2aXNpdG9yX2lkIjoiODM3MzE4OTA0MjI5ODM5OTgyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac7d15612bea7ce472dbcde612dce747aacb9fc93586a0d8c12382e7aa3bd8d1db
hovercard-subject-tagissue:1548395059
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/101144/issue_layout
twitter:imagehttps://opengraph.githubassets.com/a927e5f84173c2bbcc7bf5241d9a874399be45d5b88ea1fe4982246d658d9d7c/python/cpython/issues/101144
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/a927e5f84173c2bbcc7bf5241d9a874399be45d5b88ea1fe4982246d658d9d7c/python/cpython/issues/101144
og:image:altThis is a regression from 3.9 behavior seen in Python 3.10. zipfile.Path.read_text passes *args and **kwargs to it's own open() method, but in 3.10+ is also blindly sets kwargs["encodings"] to a va...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamegpshead
hostnamegithub.com
expected-hostnamegithub.com
Nonedf99b7164e1d961b639cf5d3cbd6b5ba673edc67bd7e47cdc4746b96099e11ae
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
release3146ab55fc8763ab0e1d2a875e600b3a545bc751
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/101144#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F101144
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/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/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/enterprise/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%2Fissues%2F101144
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%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/101144
Reloadhttps://github.com/python/cpython/issues/101144
Reloadhttps://github.com/python/cpython/issues/101144
Please reload this pagehttps://github.com/python/cpython/issues/101144
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/101144
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 35k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.8k 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
zipfile.Path.read_text & .open methods with a positional encoding arg causes a TypeErrorhttps://github.com/python/cpython/issues/101144#top
https://github.com/jaraco
3.10only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.10%22
3.11only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.11%22
triagedThe issue has been accepted as valid by a triager.https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22triaged%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/gpshead
gpsheadhttps://github.com/gpshead
on Jan 19, 2023https://github.com/python/cpython/issues/101144#issue-1548395059
@jaracohttps://github.com/jaraco
zipphttps://github.com/jaraco/zipp
gh-101144: Allow open and read_text encoding to be positional. #101145https://github.com/python/cpython/pull/101145
[3.11] gh-101144: Allow zipfile.Path .open & .read_text encoding to be positional #101179https://github.com/python/cpython/pull/101179
[3.10] gh-101144: Allow zipfile.Path .open & .read_text encoding to be positional (GH-101179) #101182https://github.com/python/cpython/pull/101182
jaracohttps://github.com/jaraco
3.10only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.10%22
3.11only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.11%22
triagedThe issue has been accepted as valid by a triager.https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22triaged%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%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.