From 9944e2646b7bfc91a9aad36baed0541ed4916583 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 2 Jul 2026 10:18:51 +0300 Subject: [PATCH] gh-79964: Clarify the imaplib fetch example in the docs (GH-152780) A FETCH response may contain additional or unsolicited data, so the message is not always data[0][1]. (cherry picked from commit 50ae0be74988564fb09746a49eb4b8f8e740f3c3) Co-authored-by: Serhiy Storchaka Co-authored-by: Claude Opus 4.8 (1M context) --- Doc/library/imaplib.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Doc/library/imaplib.rst b/Doc/library/imaplib.rst index 8e77f7db925d98..dbee7a6be80081 100644 --- a/Doc/library/imaplib.rst +++ b/Doc/library/imaplib.rst @@ -635,3 +635,10 @@ retrieves and prints all messages:: M.close() M.logout() +.. note:: + + A ``FETCH`` response may contain additional or unsolicited data + (see :rfc:`3501`, section 7.4.2), + so production code should inspect the whole response + rather than rely on ``data[0][1]``. +