Merge branch '2.0.x'

This commit is contained in:
David Lord 2021-12-22 15:21:31 -08:00
commit edac7e3a56
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
11 changed files with 122 additions and 65 deletions

View file

@ -689,7 +689,7 @@ def get_root_path(import_name: str) -> str:
# Module already imported and has a file attribute. Use that first.
mod = sys.modules.get(import_name)
if mod is not None and hasattr(mod, "__file__"):
if mod is not None and hasattr(mod, "__file__") and mod.__file__ is not None:
return os.path.dirname(os.path.abspath(mod.__file__))
# Next attempt: check the loader.