]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.15] gh-63121: Refresh imaplib capabilities on state changes (GH-152752) (GH-152854)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 2 Jul 2026 07:40:43 +0000 (09:40 +0200)
committerGitHub <noreply@github.com>
Thu, 2 Jul 2026 07:40:43 +0000 (07:40 +0000)
commitf4b3dd560012658deac4f74ea778ee8563cbe181
tree884777cc42fb2129640151a6ca0c702ac2e49a58
parent0ab38f48089896dad6a5ca5009883f40da63cb38
[3.15] gh-63121: Refresh imaplib capabilities on state changes (GH-152752) (GH-152854)

imaplib fetched the server capabilities only once, at connection time.
They are now also refreshed after a successful LOGIN or AUTHENTICATE,
from the CAPABILITY response the server sent or, if it sent none, by
querying it.  This lets methods such as enable() see capabilities added
after login, for example ENABLE on Gmail (gh-103451).

Capabilities advertised in the server greeting are now used too, saving
a redundant CAPABILITY command.
(cherry picked from commit c89b72abed7393d9d428f1e336e3aa02e7ef6ce8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Lib/imaplib.py
Lib/test/test_imaplib.py
Misc/NEWS.d/next/Library/2026-07-01-10-30-00.gh-issue-63121.Rm4tZp.rst [new file with mode: 0644]