[3.8] bpo-33972: Fix EmailMessage.iter_attachments raising AttributeError (GH-14119) (GH-14380)



When certain malformed messages have content-type set to 'mulitpart/*' but
still have a single part body, iter_attachments can raise AttributeError. This
patch fixes it by returning a None value instead when the body is single part.
(cherry picked from commit 02257012f6d3821d816cb6a7e8461a88a05b9a08)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>



https://bugs.python.org/issue33972
3 files changed