Merge pull request #4153 from asottile/syntax_warning_filename

Display the filename when encountering `SyntaxWarning`.
This commit is contained in:
Anthony Sottile
2018-10-15 08:40:51 -07:00
committed by GitHub
2 changed files with 2 additions and 1 deletions

View File

@@ -0,0 +1 @@
Display the filename when encountering ``SyntaxWarning``.

View File

@@ -398,7 +398,7 @@ def _rewrite_test(config, fn):
finally:
del state._indecode
try:
tree = ast.parse(source)
tree = ast.parse(source, filename=fn.strpath)
except SyntaxError:
# Let this pop up again in the real import.
state.trace("failed to parse: %r" % (fn,))