cpython icon indicating copy to clipboard operation
cpython copied to clipboard

gh-134759: `UnboundLocalError` in `email.message.Message.get_payload`

Open skv0zsneg opened this issue 6 months ago • 2 comments

Hello!

I worked on #134759 and was able to reproduce the UnboundLocalError by passing bytes payload directly to _payload. I'm not sure can we do it in a "public" way, like throw .set_payload() but if payload some how become bytes (and content-transfer-encoding is equal quoted-printable) it is now not falling :)

I'm also add myself to ACKS list, but not sure is my changes enough for it. If you say I'll remove myself with no questions.

  • Issue: gh-134759

skv0zsneg avatar Jun 28 '25 11:06 skv0zsneg

All commit authors signed the Contributor License Agreement.

CLA signed

python-cla-bot[bot] avatar Jun 28 '25 11:06 python-cla-bot[bot]

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

bedevere-app[bot] avatar Jun 28 '25 11:06 bedevere-app[bot]

As a bugfix I think we can keep this but in a follow-up PR I think we should ensure that we are only having a list, str or bytes or handle buffer objects by wrapping them into bytes.

picnixz avatar Jul 01 '25 07:07 picnixz

As a bugfix I think we can keep this but in a follow-up PR I think we should ensure that we are only having a list, str or bytes or handle buffer objects by wrapping them into bytes.

Got it. If nobody mind I can open an issue (or keep in #134759 ?) and take it in work :)

skv0zsneg avatar Jul 01 '25 10:07 skv0zsneg

I'm travelling for now but a separate issue for discussion would be better. It could break backwards compatibility so we should be careful.

picnixz avatar Jul 01 '25 11:07 picnixz

I'm also add myself to ACKS list, but not sure is my changes enough for it. If you say I'll remove myself with no questions.

IMO even contributors fixing a single typo can be added to this file so no worry!

picnixz avatar Jul 12 '25 13:07 picnixz

Thanks @skv0zsneg for the PR, and @picnixz for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. 🐍🍒⛏🤖

miss-islington-app[bot] avatar Jul 12 '25 13:07 miss-islington-app[bot]

GH-136579 is a backport of this pull request to the 3.14 branch.

bedevere-app[bot] avatar Jul 12 '25 13:07 bedevere-app[bot]

GH-136580 is a backport of this pull request to the 3.13 branch.

bedevere-app[bot] avatar Jul 12 '25 13:07 bedevere-app[bot]