ipython/ipython — pull request #6394 by minrk (2014-09-01 21:47:08+00:00)
Title: include traceback for bad reprs

instead of short custom 'repr failed' message

and add file arg to showtraceback, allowing capture of rendered tracebacks.

closes #6384

Before:

```python
In [1]: class Foo(object):
...: def __repr__(self):
...: raise Exception()
...:

In [2]: Foo()
Out[2]: ) failed: Exception: oops>
```

After:

```python
In [3]: class Foo(object):
...: def __repr__(self):
...: raise Exception('oops')
...:

In [4]: Foo()
Out[4]:
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
in __repr__(self)
1 class Foo(object):
2 def __repr__(self):
----> 3 raise Exception('oops')
4

Exception: oops
```

Note that the exception is still caught, it is just rendered as if it raised normally.