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:
authorCampbell Barton <ideasman42@gmail.com>2009-06-16 00:22:50 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-06-16 00:22:50 +0400
commit6efd2e643953b293aaf7ef0de50d08badd2f49a8 (patch)
tree41296f2326a48a72e4a2832d68eb470cd6be86e1 /source/gameengine
parent1a7d3a085632142817d2aa42ab252ca54032f35a (diff)
saving globalDict didnt work with python3.x
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 20009b7b846..b10ea7e1ab5 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -1986,6 +1986,8 @@ PyObject* initGeometry() {Py_INCREF(Py_None);return Py_None;}
PyObject* initBGL() {Py_INCREF(Py_None);return Py_None;}
#endif
+
+
void KX_SetActiveScene(class KX_Scene* scene)
{
gp_KetsjiScene = scene;
@@ -2017,11 +2019,17 @@ int saveGamePythonConfig( char **marshal_buffer)
if (pyGlobalDictMarshal) {
// for testing only
// PyObject_Print(pyGlobalDictMarshal, stderr, 0);
-
+ char *marshal_cstring;
+
+#if PY_VERSION_HEX < 0x03000000
+ marshal_cstring = PyString_AsString(pyGlobalDictMarshal);
marshal_length= PyString_Size(pyGlobalDictMarshal);
+#else // py3 uses byte arrays
+ marshal_cstring = PyBytes_AsString(pyGlobalDictMarshal);
+ marshal_length= PyBytes_Size(pyGlobalDictMarshal);
+#endif
*marshal_buffer = new char[marshal_length + 1];
- memcpy(*marshal_buffer, PyString_AsString(pyGlobalDictMarshal), marshal_length);
-
+ memcpy(*marshal_buffer, marshal_cstring, marshal_length);
Py_DECREF(pyGlobalDictMarshal);
} else {
printf("Error, GameLogic.globalDict could not be marshal'd\n");