Open
Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!
Check out: eBank.nz (Art Generator) |
Netwrck.com (AI Tools) |
Text-Generator.io (AI API) |
BitBank.nz (Crypto AI) |
ReadingTime (Kids Reading) |
RewordGame |
BigMultiplayerChess |
WebFiddle |
How.nz |
Helix AI Assistant
Activity
[-]UnboundLocalError: local variable 'bpayload' referenced before assignment[/-][+]`UnboundLocalError` in `email.message.Message.get_payload`[/+]picnixz commentedon May 26, 2025
The error is here:
cpython/Lib/email/message.py
Lines 316 to 317 in 96905bd
cc @bitdancer
makridenko commentedon May 27, 2025
hi, can i work on this?
skv0zsneg commentedon May 27, 2025
Hello! I would like to work on it but did not work with CPython at all. Will it be a problem? If not where I should start with?
sobolevn commentedon May 27, 2025
Hi, @skv0zsneg and @makridenko! Thanks a lot for your interest.
@makridenko since you were first, you can surely work on this. Because it looks like that no one else has started yet.
@skv0zsneg we value new contributors, please, don't feel left out :) You can pick any other issue from the opened ones 🤝
skv0zsneg commentedon Jun 27, 2025
Hey everyone!
Trying to reproduce this bug
UnboundLocalError
but it want falling.What I'm doing in REPL:
As mentioned by @picnixz, the error must be on line 317. To get here I use email message with
quoted-printable
encoding and body message surely get intoquopri.decodestring
but (luckly?) it does not fall. Am I miss something?OS: Linux (Ubuntu 24.04.2 LTS)
Python: Python 3.15.0a0
picnixz commentedon Jun 27, 2025
The "bad" code path is only taken when
payload
is not a string,cte == 'quoted-printable'
anddecode
is True. Considering there isWe can't just use a list because if
is_multipart()
would return true and we would early exit. So we need to use a bytes payload withdecode = True
(I think).UnboundLocalError
inemail.message.Message.get_payload
#136071email.message.Message.set_payload
#136397