From 73ec67587cb00603c680457133dc0a2cb23db11f Mon Sep 17 00:00:00 2001 From: Theo Belaire Date: Tue, 21 Jun 2022 15:16:36 -0400 Subject: [PATCH] Replace str with bytes for imaplib append and ParseFlags (#8130) Last Argument of APPEND https://github.com/python/cpython/blob/main/Lib/imaplib.py#L1497 https://github.com/python/cpython/blob/main/Lib/imaplib.py#L413 You can see it's parsed with the bytes regex MapCLRF re.compile(br'\r\n|\r|\n') https://github.com/python/cpython/blob/main/Lib/imaplib.py#L1497 You can see it's parsed with the bytes regex Flags re.compile(br'.*FLAGS \((?P[^\)]*)\)') --- stdlib/imaplib.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/imaplib.pyi b/stdlib/imaplib.pyi index af575c021..347fee386 100644 --- a/stdlib/imaplib.pyi +++ b/stdlib/imaplib.pyi @@ -55,7 +55,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: str) -> str: ... + def append(self, mailbox: str, flags: str, date_time: str, message: bytes) -> str: ... def authenticate(self, mechanism: str, authobject: Callable[[bytes], bytes | None]) -> tuple[str, str]: ... def capability(self) -> _CommandResults: ... def check(self) -> _CommandResults: ... @@ -171,5 +171,5 @@ class _Authenticator: def Internaldate2tuple(resp: bytes) -> time.struct_time: ... def Int2AP(num: int) -> str: ... -def ParseFlags(resp: str) -> tuple[str, ...]: ... +def ParseFlags(resp: bytes) -> tuple[bytes, ...]: ... def Time2Internaldate(date_time: float | time.struct_time | str) -> str: ...