]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-63121: Refresh imaplib capabilities on state changes (GH-152752)
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 2 Jul 2026 07:10:27 +0000 (10:10 +0300)
committerGitHub <noreply@github.com>
Thu, 2 Jul 2026 07:10:27 +0000 (10:10 +0300)
commitc89b72abed7393d9d428f1e336e3aa02e7ef6ce8
tree8a85751d278e29172bccb07e31e8bc7d0fb5bee0
parent384abb71445a5a37dfb4dbc5e3020ea6c0c307f7
gh-63121: Refresh imaplib capabilities on state changes (GH-152752)

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.

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]