Commit 6b5a5872 authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

Trap AttributeError in exactly one place.

parent 7db9dc2f
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment