diff options
| author | Petr Viktorin <pviktori@redhat.com> | 2021-01-06 17:40:30 +0100 |
|---|---|---|
| committer | Petr Viktorin <pviktori@redhat.com> | 2021-01-06 17:44:09 +0100 |
| commit | f146b387548711d8095002e3d1214ca98a8b0392 (patch) | |
| tree | 743ce89db44368948ae7309f1ac5c058b30ca47f | |
| parent | 95a9c474d30acc729b536f9ad88ead7efab62c5d (diff) | |
| download | python-setuptools-git-f146b387548711d8095002e3d1214ca98a8b0392.tar.gz | |
Avoid deprecated load_module() in pkg_resources namespace delaration
Fixes: https://github.com/pypa/setuptools/issues/2493
| -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 |
