From 7067c17302d2f406d460d03575d7319d7a8b73b8 2012-06-08 00:21:31 From: Bradley M. Froehle <brad.froehle@gmail.com> Date: 2012-06-08 00:21:31 Subject: [PATCH] Remove importlib dependency which not available in Python 2.6. Since we are only doing an absolute import, it suffices to just run `__import__(name)` and then find the module in `sys.modules`. Closes #1874. --- diff --git a/IPython/extensions/cythonmagic.py b/IPython/extensions/cythonmagic.py index 27bd158..e89bb0b 100644 --- a/IPython/extensions/cythonmagic.py +++ b/IPython/extensions/cythonmagic.py @@ -17,7 +17,6 @@ Parts of this code were taken from Cython.inline. import io import os, sys -from importlib import import_module import imp try: @@ -101,7 +100,8 @@ class CythonMagics(Magics): module = self._reloads[module_name] reload(module) else: - module = import_module(module_name) + __import__(module_name) + module = sys.modules[module_name] self._reloads[module_name] = module self._import_all(module)