Skip to content

Commit 46be53f

Browse files
committed
Fix UnboundLocalError for bytes payload and quoted-printable cte.
1 parent c419af9 commit 46be53f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Lib/email/message.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ def get_payload(self, i=None, decode=False):
313313
# If it does happen, turn the string into bytes in a way
314314
# guaranteed not to fail.
315315
bpayload = payload.encode('raw-unicode-escape')
316+
elif isinstance(payload, bytes):
317+
bpayload = payload
316318
if cte == 'quoted-printable':
317319
return quopri.decodestring(bpayload)
318320
elif cte == 'base64':

0 commit comments

Comments
 (0)