Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c')
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c b/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
index fedca8f9086..fbc56dfcc83 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
@@ -33,6 +33,11 @@
#include <eval.h>
#endif
+/* TODO, support python3.x */
+#if PY_VERSION_HEX >= 0x03000000
+#define DISABLE_PYTHON 1
+#endif
+
#include "DNA_text_types.h"
#include "BKE_text.h"
#include "BKE_utildefines.h"
@@ -56,13 +61,15 @@ static void node_dynamic_free_storage_cb(bNode *node);
#ifndef DISABLE_PYTHON
static PyObject *init_dynamicdict(void) {
- PyObject *newscriptdict;
+ PyObject *newscriptdict, *item;
PyGILState_STATE gilstate = PyGILState_Ensure();
newscriptdict= PyDict_New();
PyDict_SetItemString(newscriptdict, "__builtins__", PyEval_GetBuiltins());
- EXPP_dict_set_item_str(newscriptdict, "__name__", PyString_FromString("__main__"));
+ item= PyString_FromString("__main__");
+ PyDict_SetItemString(newscriptdict, "__name__", item);
+ Py_DECREF(item);
PyGILState_Release(gilstate);