From d9eee31ec81c42d9953aee0d7f0adaf211519a10 Mon Sep 17 00:00:00 2001 From: Richard Si <63936253+ichard26@users.noreply.github.com> Date: Sun, 5 Dec 2021 11:53:58 -0500 Subject: [PATCH] blib2to3 can raise TokenError and IndentationError too (#2671) --- src/black/parsing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/black/parsing.py b/src/black/parsing.py index 2fd41f0..c101643 100644 --- a/src/black/parsing.py +++ b/src/black/parsing.py @@ -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 -- 2.39.5