FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-153521: Preserve bytes message sets in imaplib by cuishuang · Pull Request #153907 · python/cpython · GitHub

Repository navigation

gh-153521: Preserve bytes message sets in imaplib - #153907

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
cuishuang:fix-imaplib-bytes-message-set
Aug 14, 2026
Merged

serhiy-storchaka merged 1 commit into
python:mainfrom
cuishuang:fix-imaplib-bytes-message-set

Conversation

Copy link
Copy Markdown
Contributor

_format_sequence_set() treated every non-integer, non-string argument as a structured sequence. As a result, a preformatted bytes message set was iterated byte by byte. For example, b"2:4" was sent on the wire as"50,58,52".

Before structured message-set support was added, bytes arguments were passed through unchanged. This therefore caused a backward compatibility regression.

This change decodes preformatted bytes and bytearray message sets as ASCII before processing structured sequence sets. It also covers bytes used through the new ?s substitution mechanism.

The tests include an end-to-end FETCH case that verifies the server receives 2:4, rather than the numeric values of the individual bytes.

Tests:

  • ./python.exe -m test test_imaplib -j1
  • make patchcheck

No additional NEWS entry is included because this fixes behavior introduced by the unreleased feature tracked by gh-153521, which already has a NEWS entry.

Signed-off-by: cuishuang <imcusg@gmail.com>

Copy link
Copy Markdown
Contributor Author

@serhiy-storchaka, would you mind taking a look at this? This fixes a backward-compatibility regression in the structured message-set support from #153522. Thanks!

serhiy-storchaka self-assigned this Aug 14, 2026

serhiy-storchaka 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks, the analysis is right and the fix is in the correct place.

LGTM. 👍

serhiy-storchaka merged commit 0d87a0b into python:main Aug 14, 2026
56 checks passed
mbeijen pushed a commit to mbeijen/cpython that referenced this pull request Aug 14, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL