Repository navigation
Conversation
With allow_empty_local=True, validate_email('@example.com') returned ascii_email=None although the address is ASCII. Since b505723 the check is a truthiness test on ascii_local_part, and an empty local part is ''. Test for None instead, which is what marks a non-ASCII local part.
Owner
|
Can you combine this with the test on the previous line? There doesn't seem to be a need to call validate_email a second time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
allow_empty_local=True, an address with an empty local part getsascii_email=None, although it is entirely ASCII:The README says
ascii_emailis present whenever an ASCII-only form exists, and this worked before 2.4.0. b505723 changed the condition fromif not ret.smtputf8:toif ret.ascii_local_part and ret.ascii_domain:, and''is falsy. This PR testsret.ascii_local_part is not Noneinstead.Noneis what marks a local part with no ASCII form, so b505723's intent (ascii_email together with smtputf8 after NFC normalization) is unchanged.After the change:
@example.com→@example.com,@exämple.com→@xn--exmple-cua.com, quoted""@example.com→@example.com. A non-ASCII local part such asö@example.comstill getsascii_email=None.Tests: extended
test_email_empty_local(fails without the change, passes with it).pytest tests/test_syntax.py tests/test_main.py -m "not network": 330 passed. flake8 with the Makefile flags is clean.