Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/code.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -108,7 +108,7 @@ def showsyntaxerror(self, filename=None, **kwargs):
"""
try:
typ, value, tb=sys.exc_info()
iffilenameandtypisSyntaxError:
iffilenameandissubclass(typ, SyntaxError):
value.filename=filename
source=kwargs.pop('source', "")
self._showtraceback(typ, value, None, source)
Expand Down
4 changes: 4 additions & 0 deletions Lib/test/test_pyrepl/test_pyrepl.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -1109,6 +1109,10 @@ def test_correct_filename_in_syntaxerrors(self):
self.skipTest("pyrepl not available")
self.assertIn("SyntaxError: invalid syntax", output)
self.assertIn("<python-input-0>", output)
commands = " b\nexit()\n"
output, exit_code = self.run_repl(commands, env=env)
self.assertIn("IndentationError: unexpected indent", output)
self.assertIn("<python-input-0>", output)

@force_not_colorized
def test_proper_tracebacklimit(self):
Expand Down