From c46c060790fac7a471a8d948e9493725e0859ebf Mon Sep 17 00:00:00 2001 From: Taneli Hukkinen Date: Tue, 25 May 2021 22:15:44 +0300 Subject: [PATCH 1/2] `Match.groups()` sequence can contain `None` values --- stdlib/typing.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index aafb1fbdf1b3..7c0436530c40 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -568,7 +568,7 @@ class Match(Generic[AnyStr]): def group(self, __group: Union[str, int] = ...) -> AnyStr: ... @overload def group(self, __group1: Union[str, int], __group2: Union[str, int], *groups: Union[str, int]) -> Tuple[AnyStr, ...]: ... - def groups(self, default: AnyStr = ...) -> Sequence[AnyStr]: ... + def groups(self, default: AnyStr = ...) -> Sequence[Optional[AnyStr]]: ... def groupdict(self, default: AnyStr = ...) -> dict[str, AnyStr]: ... def start(self, __group: Union[int, str] = ...) -> int: ... def end(self, __group: Union[int, str] = ...) -> int: ... From 8111f4e5f844626a8ed1552d6a0b973985d18798 Mon Sep 17 00:00:00 2001 From: Taneli Hukkinen Date: Tue, 25 May 2021 22:00:18 +0200 Subject: [PATCH 2/2] Update stdlib/typing.pyi --- stdlib/typing.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 7c0436530c40..2eb4847d51bf 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -568,7 +568,7 @@ class Match(Generic[AnyStr]): def group(self, __group: Union[str, int] = ...) -> AnyStr: ... @overload def group(self, __group1: Union[str, int], __group2: Union[str, int], *groups: Union[str, int]) -> Tuple[AnyStr, ...]: ... - def groups(self, default: AnyStr = ...) -> Sequence[Optional[AnyStr]]: ... + def groups(self, default: AnyStr = ...) -> Sequence[Union[Any, AnyStr]]: ... def groupdict(self, default: AnyStr = ...) -> dict[str, AnyStr]: ... def start(self, __group: Union[int, str] = ...) -> int: ... def end(self, __group: Union[int, str] = ...) -> int: ...