René's URL Explorer Experiment


Title: gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline by pareshjoshij · Pull Request #142008 · python/cpython · GitHub

Open Graph Title: gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline by pareshjoshij · Pull Request #142008 · python/cpython

X Title: gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline by pareshjoshij · Pull Request #142008 · python/cpython

Description: Description This PR fixes gh-142006 where email.policy.default would raise a HeaderWriteError when folding certain long address headers. The Issue: In _header_value_parser.py, the function _steal_trailing_WSP_if_exists moves trailing whitespace from the previous line to the current one. However, if the previous line contained only that whitespace, it was left as an empty string ''. When joined, this resulted in a double newline (\n\n), which is illegal in headers and triggered the error. The Fix: Modified _steal_trailing_WSP_if_exists to remove the line entirely (lines.pop()) if it becomes empty after stealing the whitespace. Verification: Added a regression test test_fold_address_list_with_stolen_whitespace to Lib/test/test_email/test_policy.py which reproduces the reported crash and verifies the fix. Linked Issue Fixes gh-142006

Open Graph Description: Description This PR fixes gh-142006 where email.policy.default would raise a HeaderWriteError when folding certain long address headers. The Issue: In _header_value_parser.py, the function _steal_t...

X Description: Description This PR fixes gh-142006 where email.policy.default would raise a HeaderWriteError when folding certain long address headers. The Issue: In _header_value_parser.py, the function _steal_t...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:b59e3fc6-0516-d232-2439-eb6da08f02ba
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8AAE:3AE31F:61B7706:8077E63:696DB8B1
html-safe-nonceb2f85226a886f7f5b99fdccbcc5edbc54c4069de74ec86c47bca6c8db9156286
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QUFFOjNBRTMxRjo2MUI3NzA2OjgwNzdFNjM6Njk2REI4QjEiLCJ2aXNpdG9yX2lkIjoiMjU1OTE5MzA4ODg3OTMxMDU3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac16f2c1e16a60dd8cc33c3d98b5a29e7e83f167ed1cc39259df278e75fb68f245
hovercard-subject-tagpull_request:3050476249
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/142008/files
twitter:imagehttps://avatars.githubusercontent.com/u/194076591?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/194076591?s=400&v=4
og:image:altDescription This PR fixes gh-142006 where email.policy.default would raise a HeaderWriteError when folding certain long address headers. The Issue: In _header_value_parser.py, the function _steal_t...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None4922b452d03cd8dbce479d866a11bc25b59ef6ee2da23aa9b0ddefa6bd4d0064
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
release7e5ae23c70136152637ceee8d6faceb35596ec46
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/142008/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F142008%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%2F142008%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/142008/files
Reloadhttps://github.com/python/cpython/pull/142008/files
Reloadhttps://github.com/python/cpython/pull/142008/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/142008/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/142008/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
bitdancerhttps://github.com/bitdancer
python:mainhttps://github.com/python/cpython/tree/main
pareshjoshij:fix-gh-142006https://github.com/pareshjoshij/cpython/tree/fix-gh-142006
Conversation 20 https://github.com/python/cpython/pull/142008
Commits 5 https://github.com/python/cpython/pull/142008/commits
Checks 60 https://github.com/python/cpython/pull/142008/checks
Files changed https://github.com/python/cpython/pull/142008/files
Please reload this pagehttps://github.com/python/cpython/pull/142008/files
gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline https://github.com/python/cpython/pull/142008/files#top
Show all changes 5 commits https://github.com/python/cpython/pull/142008/files
328bbac Fix gh-142006: email.policy.default adds extra newline to headers pareshjoshij Nov 27, 2025 https://github.com/python/cpython/pull/142008/commits/328bbaccc7324ab11d29e615dac5e2a630ed8b8e
45d7830 📜🤖 Added by blurb_it. blurb-it[bot] Nov 27, 2025 https://github.com/python/cpython/pull/142008/commits/45d78301388179fce5f8dc9d419a7ee0601fefd9
8447ed5 Address review: fix comment style and move test pareshjoshij Nov 28, 2025 https://github.com/python/cpython/pull/142008/commits/8447ed57d6d2185a404be8ead82c178c66085b74
7d63071 Merge news file and update text pareshjoshij Nov 28, 2025 https://github.com/python/cpython/pull/142008/commits/7d630710ee9e9da0e156fd0b9f4b4af6ea51533c
55e00ae Fix test logic and comments per review pareshjoshij Dec 6, 2025 https://github.com/python/cpython/pull/142008/commits/55e00ae0d655b751eebbfbff22e18fbebcecc36b
Clear filters https://github.com/python/cpython/pull/142008/files
Please reload this pagehttps://github.com/python/cpython/pull/142008/files
Please reload this pagehttps://github.com/python/cpython/pull/142008/files
_header_value_parser.py https://github.com/python/cpython/pull/142008/files#diff-4f8d778d571b7faffb42100d1f6d0374134750c72f94c0840e9368c351b41845
test__header_value_parser.py https://github.com/python/cpython/pull/142008/files#diff-903868bb695b972a6c6c6fec7fdf1aedd13ef65e7e076aef8b0964a9ff004839
2025-11-27-10-49-13.gh-issue-142006.nzJDG5.rst https://github.com/python/cpython/pull/142008/files#diff-1cc8c3b1a4d1837fb565645840331b900e71d9310e893a0be9be42f851a3e6e4
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L439
Lib/email/_header_value_parser.pyhttps://github.com/python/cpython/pull/142008/files#diff-4f8d778d571b7faffb42100d1f6d0374134750c72f94c0840e9368c351b41845
View file https://github.com/pareshjoshij/cpython/blob/55e00ae0d655b751eebbfbff22e18fbebcecc36b/Lib/email/_header_value_parser.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/142008/{{ revealButtonHref }}
https://github.com/python/cpython/pull/142008/files#diff-4f8d778d571b7faffb42100d1f6d0374134750c72f94c0840e9368c351b41845
https://github.com/python/cpython/pull/142008/files#diff-4f8d778d571b7faffb42100d1f6d0374134750c72f94c0840e9368c351b41845
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L439
Lib/test/test_email/test__header_value_parser.pyhttps://github.com/python/cpython/pull/142008/files#diff-903868bb695b972a6c6c6fec7fdf1aedd13ef65e7e076aef8b0964a9ff004839
View file https://github.com/pareshjoshij/cpython/blob/55e00ae0d655b751eebbfbff22e18fbebcecc36b/Lib/test/test_email/test__header_value_parser.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/142008/{{ revealButtonHref }}
https://github.com/python/cpython/pull/142008/files#diff-903868bb695b972a6c6c6fec7fdf1aedd13ef65e7e076aef8b0964a9ff004839
Misc/NEWS.d/next/Library/2025-11-27-10-49-13.gh-issue-142006.nzJDG5.rsthttps://github.com/python/cpython/pull/142008/files#diff-1cc8c3b1a4d1837fb565645840331b900e71d9310e893a0be9be42f851a3e6e4
View file https://github.com/pareshjoshij/cpython/blob/55e00ae0d655b751eebbfbff22e18fbebcecc36b/Misc/NEWS.d/next/Library/2025-11-27-10-49-13.gh-issue-142006.nzJDG5.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/142008/{{ revealButtonHref }}
Please reload this pagehttps://github.com/python/cpython/pull/142008/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.