8000 gh-134155: fix AttributeError in email._header_value_parser.get_address by sergey-miryanov · Pull Request #134194 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-134155: fix AttributeError in email._header_value_parser.get_address #134194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

sergey-miryanov
Copy link
Contributor
@sergey-miryanov sergey-miryanov commented May 18, 2025

There are two errors:

  1. The first one from original issue for UnboundLocalError
  2. The second one I observed when tried write a test for parse_message_id - I found that in some cases error placed to the list of tokens not of defects.

Copy link
Member
@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @bitdancer

The defects fix seems right

@picnixz picnixz changed the title gh-134152: fix unbound local error while parsing message_id in email gh-134152: fix UnboundLocalError while parsing message_id in email May 18, 2025
…0HwbX.rst

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@bitdancer
Copy link
Member

Drat. I somehow missed your PR before I submitted mine (#134233). We should combine the two. You want to pull in the extra tests from mine? Thanks for catching the defect issue.

I think my early return is clearer than setting pos=0 even though they have the same effect.

@sergey-miryanov
Copy link
Contributor Author

Yeah, your solution with early return looks better than mine.

I'm happy to revert my changes with pos=0 and keep only defects fix. After this we can keep two PRs or merge one with other. This is up to you because I'm very new here.

…thub.com:sergey-miryanov/cpython into pythongh-134152-fix-unbound-local-error-in-email
@sergey-miryanov
Copy link
Contributor Author

Tests should pass after #134233 will be merged.

@bitdancer
Copy link
Member

Sure, that works for me.

@sergey-miryanov
Copy link
Contributor Author

@bitdancer I'm sorry to bother you. Perhaps I misunderstood you. Do you expect me to merge your PR with this one?

@bitdancer
Copy link
Member

No, I just haven't gotten around to merging mine yet. I'll do it soon ;)

@sergey-miryanov
Copy link
Contributor Author

Thanks! I wasn't sure that I got you right, so I thought I'd clarify.

@hugovk
Copy link
Member
hugovk commented May 26, 2025

(Updating from main after the merge of #134233.)

@bitdancer bitdancer changed the title gh-134152: fix UnboundLocalError while parsing message_id in email gh-134155: fix UnboundLocalError while parsing message_id in email May 26, 2025
@bitdancer bitdancer changed the title gh-134155: fix UnboundLocalError while parsing message_id in email gh-134155: fix AttributeError in email._header_value_parser.get_address May 26, 2025
@bedevere-app
Copy link
bedevere-app bot commented May 26, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@bedevere-app
Copy link
bedevere-app bot commented May 26, 2025

Thanks for making the requested changes!

@bitdancer: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from bitdancer May 26, 2025 19:23
Copy link
Member
@bitdancer bitdancer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it was a stupid mistake on my part :)

PR looks good just one tweak.

@bedevere-app
Copy link
bedevere-app bot commented May 26, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@sergey-miryanov
Copy link
Contributor Author

I have made the requested changes; please review again.

@bedevere-app
Copy link
bedevere-app bot commented May 27, 2025

Thanks for making the requested changes!

@bitdancer: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from bitdancer May 27, 2025 05:59
@bitdancer bitdancer added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jun 5, 2025
@bitdancer bitdancer merged commit d9cad07 into python:main Jun 5, 2025
48 of 51 checks passed
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 5, 2025
…_address (pythonGH-134194)

Append the defect to defects instead of to the parse tree.
(cherry picked from commit d9cad074d52fe31327429fd81e4d2eeea3dbe35b)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
@bedevere-app
Copy link
bedevere-app bot commented Jun 5, 2025

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

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jun 5, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 5, 2025
…_address (pythonGH-134194)

Append the defect to defects instead of to the parse tree.
(cherry picked from commit d9cad07)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
@bedevere-app
Copy link
bedevere-app bot commented Jun 5, 2025

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

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jun 5, 2025
bitdancer pushed a commit that referenced this pull request Jun 6, 2025
…t_address (GH-134194) (#135192)

gh-134155: fix AttributeError in email._header_value_parser.get_address (GH-134194)

Append the defect to defects instead of to the parse tree.
(cherry picked from commit d9cad07)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
bitdancer pushed a commit that referenced this pull request Jun 6, 2025
…t_address (GH-134194) (#135191)

gh-134155: fix AttributeError in email._header_value_parser.get_address (GH-134194)

Append the defect to defects instead of to the parse tree.
(cherry picked from commit d9cad07)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0