ipython/ipython — comment on commit 920beabd30116f379d0be2806940f24e17dd9a32
File:  line 0
By thisch:

this commit broke the following:

In [1]: for a in b
File "", line 1
for a in b
^
SyntaxError: invalid syntax

In [2]: %tb
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/home/thomas/ in ()
----> 1 get_ipython().magic(u'tb')

/usr/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s, next_input)
2018 self._magic_locals = sys._getframe(1).f_locals
2019 with self.builtin_trap:
-> 2020 result = fn(magic_args)
2021 # Ensure we're not keeping object references around:
2022 self._magic_locals = {}

/usr/lib/python2.7/site-packages/IPython/core/magic.pyc in magic_tb(self, s)
3547
3548 See %xmode for changing exception reporting modes."""
-> 3549 self.shell.showtraceback()
3550
3551 @skip_doctest

/usr/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in showtraceback(self, exc_tuple, filename, tb_offset, exception_only)
1657 # Though this won't be called by syntax errors in the input
1658 # line, there may be SyntaxError cases with imported code.
-> 1659 self.showsyntaxerror(filename)
1660 elif etype is UsageError:
1661 self.write_err("UsageError: %s" % value)

/usr/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in showsyntaxerror(self, filename)
1723 pass
1724
-> 1725 stb = self.SyntaxTB.structured_traceback(etype, value, [])
1726 self._showtraceback(etype, value, stb)
1727

/usr/lib/python2.7/site-packages/IPython/core/ultratb.pyc in structured_traceback(self, etype, value, elist, tb_offset, context)
489 out_list.extend(self._format_list(elist))
490 # The exception info should be a single entry in the list.
--> 491 lines = ''.join(self._format_exception_only(etype, value))
492 out_list.append(lines)
493

/usr/lib/python2.7/site-packages/IPython/core/ultratb.pyc in _format_exception_only(self, etype, value)
559 Colors = self.Colors
560 list = []
--> 561 stype = Colors.excName + etype.__name__ + Colors.Normal
562 if value is None:
563 # Not sure if this can still happen in Python 2.6 and above

AttributeError: 'NoneType' object has no attribute '__name__'

In [3]:

btw, can you tell me how this traceback can be syntax highlighted in markdown ?