summaryrefslogtreecommitdiff
path: root/pkg_resources
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-03-21 05:41:02 -0400
committerGitHub <noreply@github.com>2020-03-21 05:41:02 -0400
commit6b5a5872503290d6c90ab18cd72e46776977064a (patch)
treea2ba8ac267beda6d70751ae8924c603a30d6ae5b /pkg_resources
parent7db9dc2fc4b64e45979dc17ff844f997ff9fa63c (diff)
downloadpython-setuptools-git-6b5a5872503290d6c90ab18cd72e46776977064a.tar.gz
Trap AttributeError in exactly one place.
Diffstat (limited to 'pkg_resources')
-rw-r--r--pkg_resources/__init__.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index deea96b9..2f6c0cbf 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -2102,14 +2102,10 @@ def _handle_ns(packageName, path_item):
try:
loader = importer.find_spec(packageName).loader
except AttributeError:
- try:
- # capture warnings due to #1111
- with warnings.catch_warnings():
- warnings.simplefilter("ignore")
- loader = importer.find_module(packageName)
- except AttributeError:
- # not a system module
- loader = None
+ # capture warnings due to #1111
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore")
+ loader = importer.find_module(packageName)
if loader is None:
return None