BGE Py API using python3 c/api calls. include bpy_compat.h to support py2.x
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user