Update message.py

use `email.message_from_bytes()` instead of decoding the bytes to then call `message_from_string`
This commit is contained in:
Asiel Díaz Benítez
2019-11-30 23:21:40 -05:00
committed by holger krekel
parent 5f1e5ef206
commit 369bb9166e

View File

@@ -162,7 +162,7 @@ class Message(object):
if mime_headers:
s = ffi.string(ffi.gc(mime_headers, lib.dc_str_unref))
if isinstance(s, bytes):
s = s.decode("ascii")
return email.message_from_bytes(s)
return email.message_from_string(s)
@property