Commit 34124cd5 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

use get_filename() on importlib loaders

The filename attribute is not present on all loader classes, the
get_filename() method is the correct way of getting a module's file
name.
parent 41a6aae5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -41,11 +41,11 @@ def _import_module(module, exclude):
	if module not in sys.modules:
		loader = pkgutil.get_loader(module)
		if isinstance(exclude, string_types):
			if fnmatch(loader.filename, exclude):
			if fnmatch(loader.get_filename(), exclude):
				return
		elif exclude:
			for pattern in exclude:
				if fnmatch(loader.filename, pattern):
				if fnmatch(loader.get_filename(), pattern):
					return
		sys.modules[module] = importlib.import_module(module)
	return sys.modules[module]