From 2ec227e1aa3058ad78bc46942bd41a9bdf20056b Mon Sep 17 00:00:00 2001 From: relikd Date: Wed, 22 Jul 2026 19:22:25 +0200 Subject: [PATCH 1/2] fix: re.findall specific types --- stdlib/re.pyi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/re.pyi b/stdlib/re.pyi index 8f63cc199e62..41372459084d 100644 --- a/stdlib/re.pyi +++ b/stdlib/re.pyi @@ -171,9 +171,9 @@ class Pattern(Generic[AnyStr]): # return type depends on the number of groups in the pattern @overload - def findall(self: Pattern[str], string: str, pos: int = 0, endpos: int = sys.maxsize) -> list[Any]: ... + def findall(self: Pattern[str], string: str, pos: int = 0, endpos: int = sys.maxsize) -> list[str]: ... @overload - def findall(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> list[Any]: ... + def findall(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> list[bytes]: ... @overload def findall(self, string: AnyStr, pos: int = 0, endpos: int = sys.maxsize) -> list[AnyStr]: ... @@ -303,9 +303,9 @@ def split( ) -> list[bytes | MaybeNone]: ... @overload -def findall(pattern: str | Pattern[str], string: str, flags: _FlagsType = 0) -> list[Any]: ... +def findall(pattern: str | Pattern[str], string: str, flags: _FlagsType = 0) -> list[str]: ... @overload -def findall(pattern: bytes | Pattern[bytes], string: ReadableBuffer, flags: _FlagsType = 0) -> list[Any]: ... +def findall(pattern: bytes | Pattern[bytes], string: ReadableBuffer, flags: _FlagsType = 0) -> list[bytes]: ... @overload def finditer(pattern: str | Pattern[str], string: str, flags: _FlagsType = 0) -> Iterator[Match[str]]: ... From 17a6a0f1cd3c4e0cd20d67774c52d37a2455e828 Mon Sep 17 00:00:00 2001 From: relikd Date: Wed, 22 Jul 2026 19:57:45 +0200 Subject: [PATCH 2/2] chore: comment on re.findall --- stdlib/re.pyi | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/stdlib/re.pyi b/stdlib/re.pyi index 41372459084d..f0a892c797e9 100644 --- a/stdlib/re.pyi +++ b/stdlib/re.pyi @@ -169,11 +169,11 @@ class Pattern(Generic[AnyStr]): @overload def split(self, string: AnyStr, maxsplit: int = 0) -> list[AnyStr | MaybeNone]: ... - # return type depends on the number of groups in the pattern + # return type is either list[str/bytes] or list[tuple[str/bytes, ...]] @overload - def findall(self: Pattern[str], string: str, pos: int = 0, endpos: int = sys.maxsize) -> list[str]: ... + def findall(self: Pattern[str], string: str, pos: int = 0, endpos: int = sys.maxsize) -> list[Any]: ... @overload - def findall(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> list[bytes]: ... + def findall(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> list[Any]: ... @overload def findall(self, string: AnyStr, pos: int = 0, endpos: int = sys.maxsize) -> list[AnyStr]: ... @@ -302,10 +302,11 @@ def split( pattern: bytes | Pattern[bytes], string: ReadableBuffer, maxsplit: int = 0, flags: _FlagsType = 0 ) -> list[bytes | MaybeNone]: ... +# return type is either list[str/bytes] or list[tuple[str/bytes, ...]] @overload -def findall(pattern: str | Pattern[str], string: str, flags: _FlagsType = 0) -> list[str]: ... +def findall(pattern: str | Pattern[str], string: str, flags: _FlagsType = 0) -> list[Any]: ... @overload -def findall(pattern: bytes | Pattern[bytes], string: ReadableBuffer, flags: _FlagsType = 0) -> list[bytes]: ... +def findall(pattern: bytes | Pattern[bytes], string: ReadableBuffer, flags: _FlagsType = 0) -> list[Any]: ... @overload def finditer(pattern: str | Pattern[str], string: str, flags: _FlagsType = 0) -> Iterator[Match[str]]: ...