protect flush_figures post-exec function from user error
protect flush_figures post-exec function from user error

Invalid matplotlib data may raise inside print_figure.  flush_figures()
is a post-exec function, so user errors should not raise.  Instead,
call get_ipython().showtraceback() if called from IPython, raising as before
otherwise.

ipython/ipython,ipython/ipython