From 89030ea17a27fd9ce823e5522c7560f095b9b75b Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Sat, 22 Jun 2019 17:48:49 +0200 Subject: [PATCH] Fix annotation of re.Match 'lastindex' and 'lastgroup' in Python 3 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 43202e017355..d3aee9508aca 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