mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Merge #18324: set_payload now correctly handles binary input.
This commit is contained in:
commit
b8c537094d
4 changed files with 45 additions and 16 deletions
|
@ -303,6 +303,8 @@ class Message:
|
|||
Optional charset sets the message's default character set. See
|
||||
set_charset() for details.
|
||||
"""
|
||||
if isinstance(payload, bytes):
|
||||
payload = payload.decode('ascii', 'surrogateescape')
|
||||
self._payload = payload
|
||||
if charset is not None:
|
||||
self.set_charset(charset)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue