Skip to content

gh-156312: Prevent mailbox.MH replacement failures from corrupting messages - #156313

Draft
lpyu001 wants to merge 2 commits into
python:mainfrom
lpyu001:fix-mailbox-bug-156312
Draft

gh-156312: Prevent mailbox.MH replacement failures from corrupting messages#156313
lpyu001 wants to merge 2 commits into
python:mainfrom
lpyu001:fix-mailbox-bug-156312

Conversation

@lpyu001

@lpyu001 lpyu001 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Make mailbox.MH.__setitem__() failure-atomic by writing replacements to a temporary file before replacing the original. Failed serialization now leaves the existing message unchanged.

…ing messages

Make `mailbox.MH.__setitem__()` failure-atomic by writing replacements to a temporary file before replacing the original. Failed serialization now leaves the existing message unchanged.
Serialize the replacement to a temporary file before overwriting the existing MH message, so invalid input or input read errors leave the original message unchanged.

Co-Authored-By: lipengyu <lipengyu@kylinos.cn>
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.

1 participant