mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
#16564: Fix regression in use of encoders.encode_noop with binary data.
This commit is contained in:
parent
d489c7a0a3
commit
ceaa8b1d75
4 changed files with 28 additions and 0 deletions
|
|
@ -76,3 +76,9 @@ def encode_7or8bit(msg):
|
|||
|
||||
def encode_noop(msg):
|
||||
"""Do nothing."""
|
||||
# Well, not quite *nothing*: in Python3 we have to turn bytes into a string
|
||||
# in our internal surrogateescaped form in order to keep the model
|
||||
# consistent.
|
||||
orig = msg.get_payload()
|
||||
if not isinstance(orig, str):
|
||||
msg.set_payload(orig.decode('ascii', 'surrogateescape'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue