diff options
author | Nathaniel J. Smith <njs@pobox.com> | 2016-07-18 18:52:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-18 18:52:12 -0700 |
commit | 3a0ba42bef9aaeeebccde9f03e798a78eecb3972 (patch) | |
tree | 09b929a812302d1061a16f93e6439938ca1b7584 | |
parent | e825e76be5bad3f9373392020094b4379330bbb9 (diff) | |
parent | bfa4ad3f93608074bacf04c4d9ed0546dd443163 (diff) | |
download | numpy-3a0ba42bef9aaeeebccde9f03e798a78eecb3972.tar.gz |
Merge pull request #7848 from charris/imp-module-deprecation
MAINT: Fix remaining uses of deprecated Python imp module.
-rw-r--r-- | numpy/core/setup.py | 12 | ||||
-rwxr-xr-x | runtests.py | 7 |
2 files changed, 11 insertions, 8 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py index 593b21f6d..32a1a8d60 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -10,9 +10,10 @@ from os.path import join from numpy.distutils import log from distutils.dep_util import newer from distutils.sysconfig import get_config_var -from numpy._build_utils.apple_accelerate import (uses_accelerate_framework, - get_sgemv_fix) - +from numpy._build_utils.apple_accelerate import ( + uses_accelerate_framework, get_sgemv_fix + ) +from numpy.compat import npy_load_module from setup_common import * # Set to True to enable relaxed strides checking. This (mostly) means @@ -386,9 +387,8 @@ def configuration(parent_package='',top_path=None): generate_umath_py = join(codegen_dir, 'generate_umath.py') n = dot_join(config.name, 'generate_umath') - generate_umath = imp.load_module('_'.join(n.split('.')), - open(generate_umath_py, 'U'), generate_umath_py, - ('.py', 'U', 1)) + generate_umath = npy_load_module('_'.join(n.split('.')), + generate_umath_py, ('.py', 'U', 1)) header_dir = 'include/numpy' # this is relative to config.path_in_package diff --git a/runtests.py b/runtests.py index b833bbd04..8d1758e34 100755 --- a/runtests.py +++ b/runtests.py @@ -148,14 +148,17 @@ def main(argv): if args.python: # Debugging issues with warnings is much easier if you can see them print("Enabling display of all warnings") - import warnings; warnings.filterwarnings("always") + import warnings + import types + + warnings.filterwarnings("always") if extra_argv: # Don't use subprocess, since we don't want to include the # current path in PYTHONPATH. sys.argv = extra_argv with open(extra_argv[0], 'r') as f: script = f.read() - sys.modules['__main__'] = imp.new_module('__main__') + sys.modules['__main__'] = types.ModuleType('__main__') ns = dict(__name__='__main__', __file__=extra_argv[0]) exec_(script, ns) |