mirror of https://github.com/python/cpython
Fix a bad assumption that all objects assigned to '__loader__' on a module
will have a '_files' attribute.
This commit is contained in:
parent
87fa559479
commit
8211297a7e
|
@ -37,7 +37,8 @@ def requires(resource, msg=None):
|
||||||
|
|
||||||
def find_package_modules(package, mask):
|
def find_package_modules(package, mask):
|
||||||
import fnmatch
|
import fnmatch
|
||||||
if hasattr(package, "__loader__"):
|
if (hasattr(package, "__loader__") and
|
||||||
|
hasattr(package.__loader__, '_files')):
|
||||||
path = package.__name__.replace(".", os.path.sep)
|
path = package.__name__.replace(".", os.path.sep)
|
||||||
mask = os.path.join(path, mask)
|
mask = os.path.join(path, mask)
|
||||||
for fnm in package.__loader__._files.iterkeys():
|
for fnm in package.__loader__._files.iterkeys():
|
||||||
|
|
Loading…
Reference in New Issue