From bdd49d0f3a3469608b7581419b68699ed3350c34 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Sat, 22 Jun 2019 19:18:16 +0200 Subject: [PATCH] Fix annotation of re.Match 'lastindex' and 'lastgroup' in Python 3 (#3085) Both are None if there were no groups matched. Also 'lastgroup' will be None if the matched group was nameless. The Python 2 versions of these annotations already used Optional. --- stdlib/3/typing.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index 43202e017..d3aee9508 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -517,8 +517,8 @@ class ByteString(Sequence[int], metaclass=ABCMeta): ... class Match(Generic[AnyStr]): pos = 0 endpos = 0 - lastindex = 0 - lastgroup: AnyStr + lastindex: Optional[int] + lastgroup: Optional[AnyStr] string: AnyStr # The regular expression object whose match() or search() method produced