summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-01-08 22:54:36 -0500
committerGitHub <noreply@github.com>2021-01-08 22:54:36 -0500
commita54d9e6b30c6da0542698144d2ff149ae7cadc9a (patch)
tree37b5963cc56eaaf365b172f08bc62dd48cb458b4
parent3703869bc8008bc4bcb7092d1ec9c1e8c1c994e8 (diff)
parentf146b387548711d8095002e3d1214ca98a8b0392 (diff)
downloadpython-setuptools-git-a54d9e6b30c6da0542698144d2ff149ae7cadc9a.tar.gz
Merge pull request #2523 from encukou/load_module
Avoid deprecated load_module() in pkg_resources namespace delaration
-rw-r--r--changelog.d/2493.change.rst2
-rw-r--r--pkg_resources/__init__.py3
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