Skip to content

gh-155917: Narrow bare except in email._header_value_parser.get_parameter - #155916

Open
cmw0213 wants to merge 1 commit into
python:mainfrom
cmw0213:fix-email-bare-except
Open

gh-155917: Narrow bare except in email._header_value_parser.get_parameter#155916
cmw0213 wants to merge 1 commit into
python:mainfrom
cmw0213:fix-email-bare-except

Conversation

@cmw0213

@cmw0213 cmw0213 commented Aug 17, 2026

Copy link
Copy Markdown
  • Issue title follows standard format (or no issue needed for simple fix)
  • Tests passed (./python -m test test_email)

Summary of Changes

In Lib/email/_header_value_parser.py, all other 31 call sites catch specific exceptions like errors.HeaderParseError.
This PR replaces the single remaining bare except: inside get_parameter() with except errors.HeaderParseError: to prevent masking unexpected exceptions.

@cmw0213
cmw0213 requested a review from a team as a code owner August 17, 2026 02:16
@bedevere-app

bedevere-app Bot commented Aug 17, 2026

Copy link
Copy Markdown

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.

@cmw0213 cmw0213 changed the title gh-00000: Narrow bare except in email._header_value_parser.get_parameter Narrow bare except in email._header_value_parser.get_parameter Aug 17, 2026
@cmw0213 cmw0213 changed the title Narrow bare except in email._header_value_parser.get_parameter gh-155917: Narrow bare except in email._header_value_parser.get_parameter Aug 17, 2026
@cmw0213

cmw0213 commented Aug 17, 2026

Copy link
Copy Markdown
Author

cc @hugovk @corona10

@corona10 corona10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm!

@corona10
corona10 enabled auto-merge (squash) August 17, 2026 02:34
@github-project-automation github-project-automation Bot moved this from Todo to In Progress in Sprint Aug 17, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Sprint Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants