Abhilash Raj <raj.abhila...@gmail.com> added the comment:

I agree that we currently abandon parsing (raise `HeaderParseError`) when we 
encounter a unexpected token when parsing domain (expected token is 
dot-atom-text).

However, that mechanism is meant to signal the higher level parser that we 
should look for a different type of token. In case of domain, we don't fallback 
to anything.

I believe we should fallback to `get_unstructured` when we do encounter an 
invalid domain (either `foo.` or `foo@exaomple` or `f...@example.com`) and 
register defect. But, the `.domain` attribute on the address class should be 
None if the domain is invalid.

My proposed solution of `get_unstrucutured` is perhaps not a great idea either 
since we would end up parsing more than we should (maybe we should parse until 
`>`?) in case of AddrList or something.

I would love to know what David and Barry think about this one?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34155>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to