From 67aa90fc942363d8487990036993433d48ff3469 Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 28 Jan 2020 16:25:15 +0000 Subject: [PATCH] move "dont unload core modules" to where it won't affect reloads --- src/ModuleManager.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ModuleManager.py b/src/ModuleManager.py index 48d314c2..93545c59 100644 --- a/src/ModuleManager.py +++ b/src/ModuleManager.py @@ -354,13 +354,14 @@ class ModuleManager(object): if not name in self.modules: raise ModuleNotLoadedException(name) loaded_module = self.modules[name] + + if loaded_module.is_core: + raise ModuleCannotUnloadException("cannot unload core modules") + self._unload_module(loaded_module) del self.modules[loaded_module.name] def _unload_module(self, loaded_module: LoadedModule): - if loaded_module.is_core: - raise ModuleCannotUnloadException("cannot unload core modules") - if hasattr(loaded_module.module, "unload"): try: loaded_module.module.unload()