##// END OF EJS Templates
Fix traceback handling of SyntaxErrors without linenos.
Jez Ng -
Show More
@@ -93,3 +93,9 b' class IndentationErrorTest(unittest.TestCase):'
93 with tt.AssertPrints("IndentationError"):
93 with tt.AssertPrints("IndentationError"):
94 with tt.AssertPrints("zoon()", suppress=False):
94 with tt.AssertPrints("zoon()", suppress=False):
95 ip.magic('run %s' % fname)
95 ip.magic('run %s' % fname)
96
97 class SyntaxErrorTest(unittest.TestCase):
98 def test_syntaxerror_without_lineno(self):
99 with tt.AssertNotPrints("TypeError"):
100 with tt.AssertPrints("line unknown"):
101 ip.run_cell("raise SyntaxError()")
@@ -556,7 +556,8 b' class ListTB(TBTools):'
556 have_filedata = True
556 have_filedata = True
557 #print 'filename is',filename # dbg
557 #print 'filename is',filename # dbg
558 if not value.filename: value.filename = "<string>"
558 if not value.filename: value.filename = "<string>"
559 list.append('%s File %s"%s"%s, line %s%d%s\n' % \
559 if not value.lineno: value.lineno = "unknown"
560 list.append('%s File %s"%s"%s, line %s%s%s\n' % \
560 (Colors.normalEm,
561 (Colors.normalEm,
561 Colors.filenameEm, py3compat.cast_unicode(value.filename), Colors.normalEm,
562 Colors.filenameEm, py3compat.cast_unicode(value.filename), Colors.normalEm,
562 Colors.linenoEm, value.lineno, Colors.Normal ))
563 Colors.linenoEm, value.lineno, Colors.Normal ))
General Comments 0
You need to be logged in to leave comments. Login now