Merge pull request #4153 from asottile/syntax_warning_filename
Display the filename when encountering `SyntaxWarning`.
This commit is contained in:
1
changelog/4152.bugfix.rst
Normal file
1
changelog/4152.bugfix.rst
Normal file
@@ -0,0 +1 @@
|
||||
Display the filename when encountering ``SyntaxWarning``.
|
||||
@@ -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,))
|
||||
|
||||
Reference in New Issue
Block a user