sympy/sympy — pull request #1168 by smichr (2012-03-25 01:01:17+00:00)
Title: capture restores stdout even if function func() fails

Previously, if you made a mistake in the function you passed
to capture, it would not restore the output to stdout.

e.g.

>>> capture(pprint(x/y))
x
-
y
Traceback (most recent call last):
File "", line 1, in
File "sympy\utilities\iterables.py", line 461, in capture
func()
TypeError: 'NoneType' object is not callable
>>> print 1 # output still captured by StringIO
>>>