diff options
| -rw-r--r-- | changelog.d/2493.change.rst | 2 | ||||
| -rw-r--r-- | pkg_resources/__init__.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/changelog.d/2493.change.rst b/changelog.d/2493.change.rst new file mode 100644 index 00000000..f2c46932 --- /dev/null +++ b/changelog.d/2493.change.rst @@ -0,0 +1,2 @@ +Use importlib.import_module() rather than the deprectated loader.load_module() +in pkg_resources namespace delaration -- by :user:`encukou` diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 737f4d5f..99b7f680 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -38,6 +38,7 @@ import itertools import inspect import ntpath import posixpath +import importlib from pkgutil import get_importer try: @@ -2209,7 +2210,7 @@ def _handle_ns(packageName, path_item): if subpath is not None: path = module.__path__ path.append(subpath) - loader.load_module(packageName) + importlib.import_module(packageName) _rebuild_mod_path(path, packageName, module) return subpath |
