-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-81074: Allow non-ASCII addr_spec in email.headerregistry.Address #122477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The email.headerregistry.Address constructor raised an error if addr_spec contained a non-ASCII character. (But it fully supports non-ASCII in the separate username and domain args.) This change removes the error for a non-ASCII addr_spec.
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
@bitdancer, as the email expert, do you want to review this? |
Yes, I'll add it to my list. It will take me quite some time to get through the backlog, unfortunately. |
if not isinstance(defect, errors.NonASCIILocalPartDefect) | ||
] | ||
if relevant_defects: | ||
raise relevant_defects[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started to write that this should have a comment because the context was lacking, but when I wrote it I realized what this really means is that NonASCIILocalPartDefect is not a true defect. Especially when you consider that the comments say it can only happen when parsing unicode, not when parsing bytes. So instead of doing this, now that we're doing the serialization check (which is where it becomes a true defect) we should just remove the check for this defect in _header_value_parser.
We can't remove it from errors.py for backward compatibility reasons, but it should be marked as deprecated.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
The email.headerregistry.Address constructor raised an error if addr_spec contained a non-ASCII character. (But it fully supports non-ASCII in the separate username and domain args.) This change removes the error for a non-ASCII addr_spec.
This PR implements @bitdancer's suggested fix from #81074 (comment):
(The other bugs discussed in that comment are reported separately as #83938 and #122476.)
Fixes gh-81074