Merge pull request #4153 from asottile/syntax_warning_filename
Display the filename when encountering `SyntaxWarning`.
This commit is contained in:
commit
093e19a7d9
|
@ -0,0 +1 @@
|
||||||
|
Display the filename when encountering ``SyntaxWarning``.
|
|
@ -398,7 +398,7 @@ def _rewrite_test(config, fn):
|
||||||
finally:
|
finally:
|
||||||
del state._indecode
|
del state._indecode
|
||||||
try:
|
try:
|
||||||
tree = ast.parse(source)
|
tree = ast.parse(source, filename=fn.strpath)
|
||||||
except SyntaxError:
|
except SyntaxError:
|
||||||
# Let this pop up again in the real import.
|
# Let this pop up again in the real import.
|
||||||
state.trace("failed to parse: %r" % (fn,))
|
state.trace("failed to parse: %r" % (fn,))
|
||||||
|
|
Loading…
Reference in New Issue