diff options
Diffstat (limited to 'source/gameengine/Ketsji/KX_PythonSeq.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonSeq.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp index 524d957a80c..1098dc03b62 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.cpp +++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp @@ -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; @@ -362,13 +362,7 @@ static PyObject *KX_PythonSeq_repr( KX_PythonSeq * self ) /* Python KX_PythonSeq_Type structure definition: */ /*****************************************************************************/ PyTypeObject KX_PythonSeq_Type = { -#if (PY_VERSION_HEX >= 0x02060000) PyVarObject_HEAD_INIT(NULL, 0) -#else - /* python 2.5 and below */ - PyObject_HEAD_INIT( NULL ) /* required py macro */ - 0, /* ob_size */ -#endif /* For printing, in format "<module>.<name>" */ "KX_PythonSeq", /* char *tp_name; */ sizeof( KX_PythonSeq ), /* int tp_basicsize; */ @@ -380,11 +374,8 @@ PyTypeObject KX_PythonSeq_Type = { NULL, /* printfunc tp_print; */ NULL, /* getattrfunc tp_getattr; */ NULL, /* setattrfunc tp_setattr; */ -#if PY_VERSION_HEX >= 0x03000000 // TODO - richcmp - NULL, -#else - ( cmpfunc ) KX_PythonSeq_compare, /* cmpfunc tp_compare; */ -#endif + /* TODO, richcmp */ + NULL, /* ( cmpfunc ) KX_PythonSeq_compare, // cmpfunc tp_compare; */ ( reprfunc ) KX_PythonSeq_repr, /* reprfunc tp_repr; */ /* Method suites for standard classes */ |