Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -3498,14 +3498,11 @@ def show(cls, *, block=None):
if cls.mainloop is None:
return
if block is None:
# Hack: Are we in IPython's pylab mode?
# Hack: Are we in IPython's %pylab mode? In pylab mode, IPython
# (>= 0.10) tacks a _needmain attribute onto pyplot.show (always
# set to False).
from matplotlib import pyplot
try:
# IPython versions >= 0.10 tack the _needmain attribute onto
# pyplot.show, and always set it to False, when in %pylab mode.
ipython_pylab = not pyplot.show._needmain
except AttributeError:
ipython_pylab = False
ipython_pylab = hasattr(pyplot.show, "_needmain")
block = not ipython_pylab and not is_interactive()
# TODO: The above is a hack to get the WebAgg backend working with
# ipython's `%pylab` mode until proper integration is implemented.
Expand Down