]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-153417: Fix BytesWarning in imaplib error messages for bytes arguments (GH-153423)
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 9 Jul 2026 13:51:45 +0000 (16:51 +0300)
committerGitHub <noreply@github.com>
Thu, 9 Jul 2026 13:51:45 +0000 (13:51 +0000)
commit11f1b70f4c981b781aaa94427dc1fceb637b2187
treea934dba14e769cf9f2791d9c85c4d429f399db72
parentcd9994e2831ea743e5423c1db56ca2ca42154e0a
gh-153417: Fix BytesWarning in imaplib error messages for bytes arguments (GH-153423)

IMAP4.select() and IMAP4.uid() formatted the mailbox and command argument
with %s in their error messages, which raised BytesWarning under -bb when the
argument was bytes and masked the real error.  Use %r instead, which is safe
for bytes and also quotes the value.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Lib/imaplib.py
Lib/test/test_imaplib.py
Misc/NEWS.d/next/Library/2026-07-09-14-00-00.gh-issue-153417.Bw7Rq2.rst [new file with mode: 0644]