Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b614c85

Browse files
committed
Be more robust against possible future IPython API changes.
1 parent 1254075 commit b614c85

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,11 @@ def _fix_ipython_backend2gui(cls):
15971597
if not ip:
15981598
return
15991599
from IPython.core import pylabtools as pt
1600+
if (not hasattr(pt, "backend2gui")
1601+
or not hasattr(ip, "enable_matplotlib")):
1602+
# In case we ever move the patch to IPython and remove these APIs,
1603+
# don't break on our side.
1604+
return
16001605
backend_mod = sys.modules[cls.__module__]
16011606
rif = getattr(backend_mod, "required_interactive_framework", None)
16021607
backend2gui_rif = {"qt5": "qt", "qt4": "qt", "gtk3": "gtk3",

0 commit comments

Comments
 (0)