Commit 17dde199 authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

Merge pull request #1563 from alhirzel/master

Change find_module to find_spec for py37 compat
parents 42d0d039 6b5a5872
In ``pkg_resources`` prefer ``find_spec`` (PEP 451) to ``find_module``.
......@@ -2197,10 +2197,14 @@ def _handle_ns(packageName, path_item):
if importer is None:
return None
# capture warnings due to #1111
with warnings.catch_warnings():
warnings.simplefilter("ignore")
loader = importer.find_module(packageName)
# use find_spec (PEP 451) and fall-back to find_module (PEP 302)
try:
loader = importer.find_spec(packageName).loader
except AttributeError:
# 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