mirror of
https://github.com/python/cpython.git
synced 2026-01-06 23:42:34 +00:00
Fix BytesGenerator._handle_text() if the message has no payload (None)
This commit is contained in:
parent
0c4cc559cb
commit
3a7ee3ab5a
1 changed files with 5 additions and 2 deletions
|
|
@ -377,8 +377,11 @@ def _write_headers(self, msg):
|
|||
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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue