svn merge -r 21041:21301 https://svn.blender.org/svnroot/bf-blender/branches/blender2...
[blender.git] / source / gameengine / Ketsji / KX_PythonSeq.cpp
index 524d957a80c6a33a379be11bbb14d86f597aa670..5b4d77156db67fa5e4699c57040ed157c5415e10 100644 (file)
@@ -221,11 +221,11 @@ static PyObject * KX_PythonSeq_subscript(PyObject * self, PyObject *key)
                return NULL;
        }
        
-       if (PyInt_Check(key)) {
-               return KX_PythonSeq_getIndex(self, PyInt_AS_LONG( key ));
+       if (PyLong_Check(key)) {
+               return KX_PythonSeq_getIndex(self, PyLong_AsSsize_t( key ));
        }
-       else if ( PyString_Check(key) ) {
-               char *name = PyString_AsString(key);
+       else if ( PyUnicode_Check(key) ) {
+               char *name = _PyUnicode_AsString(key);
                PyObjectPlus *ret = KX_PythonSeq_subscript__internal(self, name);
                
                if(ret) {
@@ -250,12 +250,12 @@ static int KX_PythonSeq_contains(PyObject *self, PyObject *key)
                PyErr_SetString(PyExc_SystemError, "key in seq, KX_PythonSeq: "BGE_PROXY_ERROR_MSG);
                return -1;
        }
-       if(!PyString_Check(key)) {
+       if(!PyUnicode_Check(key)) {
                PyErr_SetString(PyExc_SystemError, "key in seq, KX_PythonSeq: key must be a string");
                return -1;
        }
        
-       if(KX_PythonSeq_subscript__internal(self, PyString_AsString(key)))
+       if(KX_PythonSeq_subscript__internal(self, _PyUnicode_AsString(key)))
                return 1;
        
        return 0;