[issue33972] AttributeError in email.message.iter_attachments()

2018-07-01 Thread Bradley Laney


Bradley Laney  added the comment:

Hey Sven,

New here, decided to try a bit at an issue. 

According to the email.message docs, "the payload is either a string or bytes 
object, in the case of simple message objects, or a list of EmailMessage 
objects, for MIME container documents such as multipart/* and message/rfc822 
message objects."

Like you said, this error happens if the email.message.EmailMessage object is 
bad, i.e. the payload is a string or bytes but the content-type is marked as 
multipart/*. After reading online, it seems like an error is necessary.

I've proposed a small change in a pull request to make this situation raise a 
more useful error. It doesn't blow up any earlier but it at least says 
something more useful. 

The function could return instead of throwing an error, just providing an empty 
iterator, but that seems even less useful.

I fixed it on master (3.8 dev or whatever).

Best,
Brad

--
nosy: +Bradley Laney
versions: +Python 3.8 -Python 3.5

___
Python tracker 
<https://bugs.python.org/issue33972>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34031] [EASY] Incorrect usage of unittest.TestCase in test_urllib2_localnet

2018-07-03 Thread Bradley Laney


Bradley Laney  added the comment:

Hey again @pablogsal. Thanks for reviewing the email issue again. I'll try to 
fix and submit a PR for this if that's ok.

--
nosy: +Bradley Laney

___
Python tracker 
<https://bugs.python.org/issue34031>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com