]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-153417: Fix BytesWarning in imaplib error messages for bytes arguments...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 9 Jul 2026 14:31:25 +0000 (16:31 +0200)
committerGitHub <noreply@github.com>
Thu, 9 Jul 2026 14:31:25 +0000 (14:31 +0000)
commit8b6f7329fd3ee5eb510781a5dfecdb7f0631a3ca
treefcf3d07255d3c8d050805c51e2995a80c32ddbc4
parent246d9ad2554ebd51ac8db735dbd61c48fa1c5e54
[3.14] gh-153417: Fix BytesWarning in imaplib error messages for bytes arguments (GH-153423) (GH-153431)

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.
(cherry picked from commit 11f1b70f4c981b781aaa94427dc1fceb637b2187)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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]