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.
This commit is contained in:
Maarten ter Huurne
2019-06-22 19:18:16 +02:00
committed by Jelle Zijlstra
parent b0c9fa4530
commit bdd49d0f3a

View File

@@ -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