]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-63121: Refresh imaplib capabilities on state changes (GH-152752) (GH-152865)
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 5 Jul 2026 07:02:56 +0000 (10:02 +0300)
committerGitHub <noreply@github.com>
Sun, 5 Jul 2026 07:02:56 +0000 (07:02 +0000)
commitc099aa1601157de0162a70524710588a89eb6ad9
tree50a8c75a99be4de02ddd3fa62473084f1660f507
parent7933f4bf7131aa4140750f9404f5de0aa2969ced
[3.13] gh-63121: Refresh imaplib capabilities on state changes (GH-152752) (GH-152865)

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: 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]