Skip to content

gh-40889: Fix email.utils.parseaddr on multiple intermediate route hops - #160775

Open
harisawan-bit wants to merge 1 commit into
python:mainfrom
harisawan-bit:fix/gh-40889-email-parseaddr
Open

harisawan-bit wants to merge 1 commit into
python:mainfrom
harisawan-bit:fix/gh-40889-email-parseaddr

Conversation

@harisawan-bit

Copy link
Copy Markdown

Fixes gh-40889.

Summary of Changes

When \�mail.utils.parseaddr\ parses addresses containing obsolete route syntax with multiple hops (e.g. <@hop1.org,@hop2.org:foo@bar.com>), the parser fails on the comma delimiter and falls through into treating it as an invalid addrspec. Per RFC 5322 Section 4.4 (\obs-route), intermediate hops in a route address may be separated by commas.

This patch adds comma handling to \getrouteaddr()\ in \Lib/email/_parseaddr.py\ so that multi-hop route addresses resolve cleanly to the target mailbox. Regression tests added to \Lib/test/test_email/test_email.py\ and news entry added.

Copilot AI balanced review requested due to automatic review settings October 27, 2026 20:35
@harisawan-bit
harisawan-bit requested a review from a team as a code owner October 27, 2026 20:35
@python-cla-bot

python-cla-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@StanFromIreland
StanFromIreland marked this pull request as draft October 28, 2026 09:45
@harisawan-bit
harisawan-bit marked this pull request as ready for review October 28, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

email.Utils.parseaddr fails to parse valid addresses

2 participants