From 1c25c8a366ca917251879bf8712bf865675d9cad Mon Sep 17 00:00:00 2001 From: Phil Nagel Date: Fri, 26 Feb 2021 20:25:38 -0600 Subject: [PATCH 1/2] Fix IPython import issue --- lib/matplotlib/backend_bases.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 33831c4ba889..c13b87a02bc3 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -1743,7 +1743,7 @@ def _fix_ipython_backend2gui(cls): # `ipython --auto`). This cannot be done at import time due to # ordering issues, so we do it when creating a canvas, and should only # be done once per class (hence the `lru_cache(1)`). - if "IPython" not in sys.modules: + if sys.modules.get("IPython", None) is None: return import IPython ip = IPython.get_ipython() From d70d826fa06bd44373d8687ca09bcee32fa8d155 Mon Sep 17 00:00:00 2001 From: Philipp Nagel Date: Mon, 1 Mar 2021 08:42:22 -0600 Subject: [PATCH 2/2] Remove superfluous arg --- lib/matplotlib/backend_bases.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index c13b87a02bc3..3798a936ef75 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -1743,7 +1743,7 @@ def _fix_ipython_backend2gui(cls): # `ipython --auto`). This cannot be done at import time due to # ordering issues, so we do it when creating a canvas, and should only # be done once per class (hence the `lru_cache(1)`). - if sys.modules.get("IPython", None) is None: + if sys.modules.get("IPython") is None: return import IPython ip = IPython.get_ipython()