Commit 120a841e authored by Matti Picus's avatar Matti Picus Committed by Stefan Behnel

Remove deprecated import of imp module (#3350)

parent 6496c017
...@@ -35,6 +35,14 @@ if sys.version_info[0] < 3: ...@@ -35,6 +35,14 @@ if sys.version_info[0] < 3:
else: else:
to_unicode = lambda x: x to_unicode = lambda x: x
if sys.version_info[:2] < (3, 3):
import imp
def load_dynamic(name, module_path):
return imp.load_dynamic(name, module_path)
else:
from importlib.machinery import ExtensionFileLoader
def load_dynamic(name, module_path):
return ExtensionFileLoader(name, module_path).load_module()
class UnboundSymbols(EnvTransform, SkipDeclarations): class UnboundSymbols(EnvTransform, SkipDeclarations):
def __init__(self): def __init__(self):
...@@ -249,7 +257,7 @@ def __invoke(%(params)s): ...@@ -249,7 +257,7 @@ def __invoke(%(params)s):
build_extension.build_lib = lib_dir build_extension.build_lib = lib_dir
build_extension.run() build_extension.run()
module = imp.load_dynamic(module_name, module_path) module = load_dynamic(module_name, module_path)
_cython_inline_cache[orig_code, arg_sigs] = module.__invoke _cython_inline_cache[orig_code, arg_sigs] = module.__invoke
arg_list = [kwds[arg] for arg in arg_names] arg_list = [kwds[arg] for arg in arg_names]
......
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