Commit 3a7ee3ab authored by Victor Stinner's avatar Victor Stinner

Fix BytesGenerator._handle_text() if the message has no payload (None)

parent 0c4cc559
......@@ -377,8 +377,11 @@ class BytesGenerator(Generator):
def _handle_text(self, msg):
# If the string has surrogates the original source was bytes, so
# just write it back out.
if _has_surrogates(msg._payload):
self.write(msg._payload)
payload = msg.get_payload()
if payload is None:
return
if _has_surrogates(payload):
self.write(payload)
else:
super(BytesGenerator,self)._handle_text(msg)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment