From 7f0848c9d29eb719fc2a344524a78ad8fe1859b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Wed, 2 Dec 2020 09:20:13 +0100 Subject: [PATCH] Improve comments. --- src/runner/pythonrunner.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index 622c1a2..562940f 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -1135,8 +1135,8 @@ private: private: - // For each "identifier" (python file or python module folder), contains the list list - // of python objects representing to keep "alive" during the execution. + // For each "identifier" (python file or python module folder), contains the list + // of python objects to keep "alive" during the execution. std::unordered_map> m_PythonObjects; wchar_t* m_PythonHome; @@ -1470,11 +1470,14 @@ void PythonRunner::unload(const QString& identifier) GILock lock; - // We need to remove modules from the plugin from sys.module. At this point, - // the identifier is the full path to the module. if (!identifier.endsWith(".py")) { + + // At this point, the identifier is the full path to the module. QDir folder(identifier); + // We want to "unload" (remove from sys.modules) modules that come + // from this plugin (whose __path__ points under this module, including + // the module of the plugin itself). bpy::object sys = bpy::import("sys"); bpy::dict modules = bpy::extract(sys.attr("modules")); bpy::list keys = modules.keys();