File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1459,11 +1459,15 @@ def _find_keyword_typos(self):
14591459 return # Original code compiles or is incomplete - can't validate fixes
14601460
14611461 error_lines = error_code .splitlines ()
1462- tokens = [
1463- token
1464- for token in tokenize .generate_tokens (io .StringIO (error_code ).readline )
1465- if token .type == tokenize .NAME
1466- ]
1462+ tokens = []
1463+ token_stream = tokenize .generate_tokens (io .StringIO (error_code ).readline )
1464+ try :
1465+ for token in token_stream :
1466+ if token .type == tokenize .NAME :
1467+ tokens .append (token )
1468+ except tokenize .TokenError :
1469+ # Incomplete input can still contain useful tokens.
1470+ pass
14671471 # Look for typos on the reported error line first. If the parser only
14681472 # fails after an earlier typo, the remaining lines are still searched.
14691473 the_end = end_line if line == 0 else end_line + 1
You can’t perform that action at this time.
0 commit comments