Skip to content

gh-154760: Narrow bare except in email._header_value_parser - #154839

Closed
BHUVANSH855 wants to merge 1 commit into
python:mainfrom
BHUVANSH855:investigate-email-bare-except
Closed

gh-154760: Narrow bare except in email._header_value_parser#154839
BHUVANSH855 wants to merge 1 commit into
python:mainfrom
BHUVANSH855:investigate-email-bare-except

Conversation

@BHUVANSH855

@BHUVANSH855 BHUVANSH855 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Replace a bare except in email._header_value_parser.get_parameter() with
except errors.HeaderParseError.

Rationale

get_extended_attrtext() is the only operation inside the try block. It
raises errors.HeaderParseError for the parse failures this code is intended
to recover from. Narrowing the exception handler avoids suppressing unrelated
exceptions while preserving the existing recovery behavior.

I verified that the recovery path is exercised by the existing test suite and
that HeaderParseError is the expected exception for this code path.

Tests

  • ./python -m test test_email.test__header_value_parser test_email.test_headerregistry
  • ./python -m test test_email

@picnixz

picnixz commented Jul 29, 2026

Copy link
Copy Markdown
Member

The issue has nothkng to do with email. Please check the agent output before submitting. It is wasting reviewer's time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants