Author mkaiser
Recipients barry, mkaiser, r.david.murray
Date 2019-12-17.08:32:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I used email.parser.BytesParser for parsing mails. 

In one programm I used parse, because the email was stored in a file.
In a second programm the email was stored in memory as a bytes object.

I created hash values from each parts an compared them, to check if a part is already known to my programs. This works for attachments, but not for html and plain text parts.

Documentation for parsebytes:

Similar to the parse() method, except it takes a bytes-like object instead of a file-like object. Calling this method on a bytes-like object is equivalent to wrapping bytes in a BytesIO instance first and calling parse().

When I read the documentation, I expected that both methods will produce the same output.

The testmail contains 2 mimeparts. One with html and one with plain text.

The parse method with a file and the parse method with bytes-data, wrapped in a BytesIO produces the same hashes. The paesebytes method creates different hashes.

Output of my testprogram:

MD5 sums with parsebytes with bytes data
MD5 sums with parse and BytesIO with bytes data
MD5 sums with parse from file

Is this an expected behavior or is this an error?
Date User Action Args
2019-12-17 08:32:29mkaisersetrecipients: + mkaiser, barry, r.david.murray
2019-12-17 08:32:29mkaisersetmessageid: <>
2019-12-17 08:32:29mkaiserlinkissue39071 messages
2019-12-17 08:32:29mkaisercreate