#16564: Fix regression in use of encoders.encode_noop with binary data.

This commit is contained in:
R David Murray 2013-02-09 13:02:58 -05:00
parent d489c7a0a3
commit ceaa8b1d75
4 changed files with 28 additions and 0 deletions

View file

@ -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'))