python / python/cpython

HeaderParseError on email address ending with '.'

Open
#101,034 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic-email type-bug
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

Bug report

from email.headerregistry import Address
a = Address("Jane Doe", addr_spec="jane_doe@example.org.")
[…]
HeaderParseError: expected atext but found ''

The issue is the trailing dot, which is arguably not great, but it's very valid actually, and the email address provided is the same as the email address without a dot.

Your environment

  • CPython versions tested on: 3.11.1-1 on Debian unstable
  • Operating system and architecture: Debian unstable, amd64
Linked PRs
  • gh-151972

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with email.headerregistry.Address using the reproducer and inspect the header parsing path that handles the trailing dot in addr_spec. Compare the behavior with the equivalent address without the dot and review linked PR gh-151972; done means the valid trailing-dot address no longer raises HeaderParseError and has regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.