Skip to content

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

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.

@terryjreedy terryjreedy changed the title gh-154760: Narrow bare except in email._header_value_parser Narrow bare except in email._header_value_parser Aug 12, 2026
@terryjreedy

Copy link
Copy Markdown
Member

This PR at least touched an email file, even if incorrectly (I have no idea). It truly has nothing to do with the idlelib and the idlelib review issue it linked to, adding noise there. Hence I changed the title and removed as many of the bogus links as possible.

@BHUVANSH855
BHUVANSH855 deleted the investigate-email-bare-except branch August 13, 2026 04:14
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.

3 participants