diff --git a/src/blib2to3/pgen2/tokenize.py b/src/blib2to3/pgen2/tokenize.py index a6353d154c9..35dedee7008 100644 --- a/src/blib2to3/pgen2/tokenize.py +++ b/src/blib2to3/pgen2/tokenize.py @@ -163,7 +163,6 @@ def _combinations(*l): '"""': double3prog, **{f"{prefix}'''": single3prog for prefix in _strprefixes}, **{f'{prefix}"""': double3prog for prefix in _strprefixes}, - **{prefix: None for prefix in _strprefixes}, } triple_quoted: Final = ( @@ -601,9 +600,10 @@ def generate_tokens( strstart = (lnum, start) endprog = ( endprogs[initial] - or endprogs[token[1]] - or endprogs[token[2]] + or endprogs.get(token[1]) + or endprogs.get(token[2]) ) + assert endprog is not None, f"endprog not found for {token}" contstr, needcont = line[start:], 1 contline = line break