Commit: b1ee77d2d68d6fb3476f146745c3c09bdb2bcf89
Author: Sebastián Barschkis
Date:   Sat Aug 4 13:54:06 2018 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBb1ee77d2d68d6fb3476f146745c3c09bdb2bcf89

fix for odd python assertion error

error was appearing when closing blender

===================================================================

M       intern/mantaflow/intern/FLUID.cpp
M       source/blender/python/intern/bpy_interface.c

===================================================================

diff --git a/intern/mantaflow/intern/FLUID.cpp 
b/intern/mantaflow/intern/FLUID.cpp
index 8566f881009..e2a4d475128 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -1686,7 +1686,7 @@ static PyObject* callPythonFunction(std::string varName, 
std::string functionNam
        PyObject *main, *var, *func, *returnedValue;
 
        // Get pyobject that holds result value
-       main = PyImport_AddModule("__main__");
+       main = PyImport_ImportModule("__main__");
        var = PyObject_GetAttrString(main, varName.c_str());
        func = PyObject_GetAttrString(var, functionName.c_str());
 
diff --git a/source/blender/python/intern/bpy_interface.c 
b/source/blender/python/intern/bpy_interface.c
index 6de054130f7..ec72345aaf5 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -303,6 +303,10 @@ void BPY_python_start(int argc, const char **argv)
 
        /* Initialize thread support (also acquires lock) */
        PyEval_InitThreads();
+
+       /* (sebbas): Require this to prevent assertion error */
+       /* see: 
https://stackoverflow.com/questions/27844676/assertionerror-3-x-only-when-calling-py-finalize-with-threads
 */
+       Py_DECREF(PyImport_ImportModule("threading"));
 #else
        (void)argc;
        (void)argv;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to