Repository navigation
gh-158780: Preserve defects in unstructured email headers - #160862
Closed
GriffinCanCode wants to merge 5 commits into
Closed
GriffinCanCode wants to merge 5 commits into
GriffinCanCode wants to merge 5 commits into
Conversation
Member
|
The issue has been closed as not planned. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #158780.
Unstructured headers discard the defects already recorded in their parse tree.
For example,
HeaderRegistry()('Subject', '=?utf-8?b?YQ?=')decodes to'a'butreports no
InvalidBase64PaddingDefectthrough its publicdefectsattribute.Propagate those defects and avoid repeated sibling-list concatenation in the
existing collector. Keep defect order, duplicate object identity, and empty-tree
behavior. The existing parameterized tests now check decoding, defects, and
folding for both
Subjectand custom headers.This omission also appears in catalog item 34b.
The collector is listed in #136063, alongside the active parser work in #152521
and #152710. Neither PR currently implements these two changes; this is a small
fix in the same area, with that prior work acknowledged.
Validation on macOS arm64, CPython 3.16 debug:
./python.exe -m test test_email test_mailbox test_smtplib: 2,305 tests, 5 skips.make patchcheckand the applicable pinned pre-commit hooks pass.added runtime lines were profiled; bounded measurements checked CPU, wall
time, and traced allocations without claiming universal speed improvements.
test_chown_gid,three
test_glob_dotdotcases, andtest_fast_path_avoid_busy_loop. The firsttwo reproduce with the original email package; the subprocess assertion
passes in a focused rerun. The full run is not clean.
AI assistance: Codex helped investigate the behavior, prepare the patch and
tests, and run the checks and profiling.