Commit 0db6c709 authored by Robert Bradshaw's avatar Robert Bradshaw

Don't reload inline module if it's already loaded.

parent ab740487
...@@ -147,6 +147,10 @@ def cython_inline(code, ...@@ -147,6 +147,10 @@ def cython_inline(code,
key = orig_code, arg_sigs, sys.version_info, sys.executable, Cython.__version__ key = orig_code, arg_sigs, sys.version_info, sys.executable, Cython.__version__
module_name = "_cython_inline_" + hashlib.md5(str(key).encode('utf-8')).hexdigest() module_name = "_cython_inline_" + hashlib.md5(str(key).encode('utf-8')).hexdigest()
if module_name in sys.modules:
module = sys.modules[module_name]
else:
build_extension = None build_extension = None
if cython_inline.so_ext is None: if cython_inline.so_ext is None:
# Figure out and cache current extension suffix # Figure out and cache current extension suffix
...@@ -199,6 +203,7 @@ def __invoke(%(params)s): ...@@ -199,6 +203,7 @@ def __invoke(%(params)s):
build_extension.run() build_extension.run()
module = imp.load_dynamic(module_name, module_path) module = imp.load_dynamic(module_name, module_path)
arg_list = [kwds[arg] for arg in arg_names] arg_list = [kwds[arg] for arg in arg_names]
return module.__invoke(*arg_list) return module.__invoke(*arg_list)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment