summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2017-10-01 11:46:14 +0200
committerStefan Behnel <stefan_ml@behnel.de>2017-10-01 11:46:14 +0200
commit133496521e6e27c6541efe43afda177241dd21b6 (patch)
tree6e2e278d9395ebce4f11118c1ee1e2b4c681a840
parentbf442cd5a202372d5a6648f48213f4b03889d9ce (diff)
downloadcython-133496521e6e27c6541efe43afda177241dd21b6.tar.gz
Avoid calling undefined name if IPython import fails.
-rw-r--r--Cython/Build/Tests/TestIpythonMagic.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Cython/Build/Tests/TestIpythonMagic.py b/Cython/Build/Tests/TestIpythonMagic.py
index 7ece9d58b..5de27aa19 100644
--- a/Cython/Build/Tests/TestIpythonMagic.py
+++ b/Cython/Build/Tests/TestIpythonMagic.py
@@ -13,6 +13,9 @@ try:
from IPython.utils import py3compat
except:
__test__ = False
+ ip = None
+else:
+ ip = get_ipython()
try:
# disable IPython history thread to avoid having to clean it up
@@ -23,7 +26,6 @@ except ImportError:
from Cython.TestUtils import CythonTest
-ip = get_ipython()
code = py3compat.str_to_unicode("""\
def f(x):
return 2*x