This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author aft90
Recipients aft90, barry, eamanu, r.david.murray
Date 2019-10-01.07:47:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I agree with you that according to the RFC, the cte can of course only be "B" or "Q". My point is that, in my example, if you try to do that you get a KeyError propagating all the way down to email.message.get(), which I believe is incorrect. 

Consider an encoded word which is syntactically incorrect in a different way, like  if for instance it's missing the terminating '?=':


Currently, this case will cause to throw a ValueError on this line:

_, charset, cte, cte_string, _ = ew.split('?')

Which is then caught by _header_value_parser.get_encoded_word() and handled appropriately.

To me this is the same kind of thing. I agree that an exception should be thrown, I just don't think it should propagate all the way back to the caller of email.message.get().

On a separate note, I agree with you that perhaps _encoded_words.decode() should throw more specific exceptions instead of ValueError and KeyError but that's a separate thing. I can fix that if you prefer.
Date User Action Args
2019-10-01 07:47:20aft90setrecipients: + aft90, barry, r.david.murray, eamanu
2019-10-01 07:47:20aft90setmessageid: <>
2019-10-01 07:47:20aft90linkissue38332 messages
2019-10-01 07:47:20aft90create