blib2to3 can raise TokenError and IndentationError too (#2671)

This commit is contained in:
Richard Si 2021-12-05 11:53:58 -05:00 committed by GitHub
parent 9424e795bf
commit d9eee31ec8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,7 +140,7 @@ def matches_grammar(src_txt: str, grammar: Grammar) -> bool:
drv = driver.Driver(grammar)
try:
drv.parse_string(src_txt, True)
except ParseError:
except (ParseError, TokenError, IndentationError):
return False
else:
return True