From f94f233eb3b03488ddfeae7e47ea1b340d033938 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 6 Feb 2019 22:41:37 +0000 Subject: [PATCH] Fix mypy typing issue with importspec loader Optionalness (src/ModuleManager.py) --- src/ModuleManager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ModuleManager.py b/src/ModuleManager.py index f0cb8580..fb500a87 100644 --- a/src/ModuleManager.py +++ b/src/ModuleManager.py @@ -121,7 +121,8 @@ class ModuleManager(object): import_spec = importlib.util.spec_from_file_location(import_name, path) module = importlib.util.module_from_spec(import_spec) sys.modules[import_name] = module - import_spec.loader.exec_module(module) + loader = typing.cast(importlib.abc.Loader, import_spec.loader) + loader.exec_module(module) module_object_pointer = getattr(module, "Module", None) if not module_object_pointer: