Skip to content

Commit

Permalink
Hint at likely cause of ast parsing failure in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
emfdavid committed Jan 20, 2022
1 parent 9bd4134 commit 28c9ffa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/black/__init__.py
Expand Up @@ -1315,7 +1315,9 @@ def assert_equivalent(src: str, dst: str, *, pass_num: int = 1) -> None:
src_ast = parse_ast(src)
except Exception as exc:
raise AssertionError(
f"cannot use --safe with this file; failed to parse source file: {exc}"
f"cannot use --safe with this file; failed to parse source file AST: {exc}"
f"This could be caused by running black with an older python version "
f"that does not support new syntax used in your source file."
) from exc

try:
Expand Down

0 comments on commit 28c9ffa

Please sign in to comment.