Fix unloading of modules. Up warning levels to 4.

This commit is contained in:
Mikaël Capelle
2022-05-05 22:03:18 +02:00
parent 450bfa821a
commit 28210d3d7a
16 changed files with 56 additions and 53 deletions
+1 -1
View File
@@ -268,7 +268,7 @@ void PythonRunner::unload(const QString& identifier)
for (std::size_t i = 0; i < py::len(keys); ++i) {
py::object mod = modules[keys[i]];
if (PyObject_HasAttrString(mod.ptr(), "__path__")) {
QString mpath = mod.attr("__path__")[0].cast<QString>();
QString mpath = mod.attr("__path__")[py::int_(0)].cast<QString>();
if (!folder.relativeFilePath(mpath).startsWith("..")) {
// If the path is under identifier, we need to unload