classification
Title: AttributeError in email.message.get_body()
Type: Stage: patch review
Components: email Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: barry, iritkatriel, python-dev, r.david.murray, xavier2
Priority: normal Keywords: patch

Created on 2021-01-11 16:45 by xavier2, last changed 2021-01-11 16:52 by xavier2.

Files
File name Uploaded Description Edit
email_bad_formatted.eml xavier2, 2021-01-11 16:45
Pull Requests
URL Status Linked Edit
PR 24192 open python-dev, 2021-01-11 16:49
Messages (2)
msg384847 - (view) Author: Xavier Hausherr (xavier2) * Date: 2021-01-11 16:45
Following this issue: https://bugs.python.org/issue33972

Same bug apply to email.message.get_body() with attached email example and the following code: 

        from email.policy import default
        import email

        with open('email_bad_formatted.eml', 'rb') as fp:
            msg = email.message_from_binary_file(fp, policy=default)
        body = msg.get_body()

> Result:
E       AttributeError: 'str' object has no attribute 'is_attachment'

/usr/local/lib/python3.9/email/message.py:978: AttributeError
msg384848 - (view) Author: Xavier Hausherr (xavier2) * Date: 2021-01-11 16:52
Attached PR fix the issue.
History
Date User Action Args
2021-01-11 16:52:14xavier2setmessages: + msg384848
2021-01-11 16:49:48python-devsetkeywords: + patch
nosy: + python-dev

pull_requests: + pull_request23019
stage: patch review
2021-01-11 16:45:57xavier2create