From 46ec71f6bc74a0a248036b305fade5562e396c52 Mon Sep 17 00:00:00 2001 From: Matti Picus Date: Fri, 19 Nov 2021 14:51:36 +0200 Subject: ENH: provide a convenience function to replace npy_load_module (#20395) `load_module` is deprecated since python 3.4 and will be removed in python 3.12. Use `exec_module` instead. Provide a convenience function in `distutils.misc_utils` instead of `npy_load_module` from `compat.py3k`. --- numpy/testing/_private/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'numpy/testing/_private') diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py index 4c6b64bc9..0eb945d15 100644 --- a/numpy/testing/_private/utils.py +++ b/numpy/testing/_private/utils.py @@ -1228,13 +1228,13 @@ def rundocs(filename=None, raise_on_error=True): >>> np.lib.test(doctests=True) # doctest: +SKIP """ - from numpy.compat import npy_load_module + from numpy.distutils.misc_util import exec_mod_from_location import doctest if filename is None: f = sys._getframe(1) filename = f.f_globals['__file__'] name = os.path.splitext(os.path.basename(filename))[0] - m = npy_load_module(name, filename) + m = exec_mod_from_location(name, filename) tests = doctest.DocTestFinder().find(m) runner = doctest.DocTestRunner(verbose=False) -- cgit v1.2.1