From 836fbcc5dbb444eddbc84dddc85e2055bacf1430 Mon Sep 17 00:00:00 2001 From: savanto Date: Sat, 27 Dec 2025 14:19:03 -0600 Subject: [PATCH 1/2] imaplib: append returns a tuple (status, [data]) According to the docstring for append: ``` (typ, [data]) = .append(mailbox, flags, date_time, message) ``` [v3.0](https://github.com/python/cpython/blob/v3.0/Lib/imaplib.py#L313) [v3.14](https://github.com/python/cpython/blob/v3.14.0/Lib/imaplib.py#L483) Further corroborated that this is a tuple of some sort because append returns the result of `self._simple_command(...)`, which returns the result of `self._command_complete(...)`, which returns `typ, data`. --- stdlib/imaplib.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/imaplib.pyi b/stdlib/imaplib.pyi index 39fd466529bb..569cd50e22f6 100644 --- a/stdlib/imaplib.pyi +++ b/stdlib/imaplib.pyi @@ -61,7 +61,7 @@ class IMAP4: def socket(self) -> _socket: ... def recent(self) -> _CommandResults: ... def response(self, code: str) -> _CommandResults: ... - def append(self, mailbox: str, flags: str, date_time: str, message: ReadableBuffer) -> str: ... + def append(self, mailbox: str, flags: str, date_time: str, message: ReadableBuffer) -> tuple[str, list[bytes]]: ... def authenticate(self, mechanism: str, authobject: Callable[[bytes], bytes | None]) -> tuple[str, str]: ... def capability(self) -> _CommandResults: ... def check(self) -> _CommandResults: ... From ffeca6801fa453283148b6a0673ce487d292a1af Mon Sep 17 00:00:00 2001 From: savanto Date: Sun, 28 Dec 2025 12:38:04 +0000 Subject: [PATCH 2/2] Update stdlib/imaplib.pyi Co-authored-by: Semyon Moroz --- stdlib/imaplib.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/imaplib.pyi b/stdlib/imaplib.pyi index 569cd50e22f6..1f0e0106006b 100644 --- a/stdlib/imaplib.pyi +++ b/stdlib/imaplib.pyi @@ -61,7 +61,7 @@ class IMAP4: def socket(self) -> _socket: ... def recent(self) -> _CommandResults: ... def response(self, code: str) -> _CommandResults: ... - def append(self, mailbox: str, flags: str, date_time: str, message: ReadableBuffer) -> tuple[str, list[bytes]]: ... + def append(self, mailbox: str, flags: str, date_time: str, message: ReadableBuffer) -> tuple[str, _list[bytes]]: ... def authenticate(self, mechanism: str, authobject: Callable[[bytes], bytes | None]) -> tuple[str, str]: ... def capability(self) -> _CommandResults: ... def check(self) -> _CommandResults: ...