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-29 06:25:54 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-06-29 06:25:54 +0400
commitc50bbe5ae726edfb265bd54cb7ce0e547e3f4b31 (patch)
tree2fcb879d619b0794a7632575f64e5825949de4cf /source/gameengine/Expressions/ListValue.cpp
parentbb1f24ac443bcc386cf2cc3765609aaf9bf51db1 (diff)
BGE Py API using python3 c/api calls. include bpy_compat.h to support py2.x
Diffstat (limited to 'source/gameengine/Expressions/ListValue.cpp')
-rw-r--r--source/gameengine/Expressions/ListValue.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp
index 4cad4728521..34a357aa5f1 100644
--- a/source/gameengine/Expressions/ListValue.cpp
+++ b/source/gameengine/Expressions/ListValue.cpp
@@ -76,9 +76,9 @@ PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex)
return NULL;
}
- if (PyString_Check(pyindex))
+ if (PyUnicode_Check(pyindex))
{
- CValue *item = ((CListValue*) list)->FindValue(PyString_AsString(pyindex));
+ CValue *item = ((CListValue*) list)->FindValue(_PyUnicode_AsString(pyindex));
if (item) {
PyObject* pyobj = item->ConvertValueToPython();
if(pyobj)
@@ -87,14 +87,14 @@ PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex)
return item->GetProxy();
}
}
- else if (PyInt_Check(pyindex))
+ else if (PyLong_Check(pyindex))
{
- int index = PyInt_AsLong(pyindex);
+ int index = PyLong_AsSsize_t(pyindex);
return listvalue_buffer_item(self, index); /* wont add a ref */
}
PyObject *pyindex_str = PyObject_Repr(pyindex); /* new ref */
- PyErr_Format(PyExc_KeyError, "CList[key]: '%s' key not in list", PyString_AsString(pyindex_str));
+ PyErr_Format(PyExc_KeyError, "CList[key]: '%s' key not in list", _PyUnicode_AsString(pyindex_str));
Py_DECREF(pyindex_str);
return NULL;
}
@@ -220,8 +220,8 @@ static int listvalue_buffer_contains(PyObject *self_v, PyObject *value)
return -1;
}
- if (PyString_Check(value)) {
- if (self->FindValue((const char *)PyString_AsString(value))) {
+ if (PyUnicode_Check(value)) {
+ if (self->FindValue((const char *)_PyUnicode_AsString(value))) {
return 1;
}
}
@@ -542,7 +542,7 @@ PyObject* CListValue::Pyindex(PyObject *value)
CValue* elem = GetValue(i);
if (checkobj==elem || CheckEqual(checkobj,elem))
{
- result = PyInt_FromLong(i);
+ result = PyLong_FromSsize_t(i);
break;
}
}
@@ -565,7 +565,7 @@ PyObject* CListValue::Pycount(PyObject* value)
if (checkobj==NULL) { /* in this case just return that there are no items in the list */
PyErr_Clear();
- return PyInt_FromLong(0);
+ return PyLong_FromSsize_t(0);
}
int numelem = GetCount();
@@ -579,7 +579,7 @@ PyObject* CListValue::Pycount(PyObject* value)
}
checkobj->Release();
- return PyInt_FromLong(numfound);
+ return PyLong_FromSsize_t(numfound);
}
/* Matches python dict.get(key, [default]) */
@@ -606,7 +606,7 @@ PyObject* CListValue::Pyget(PyObject *args)
/* Matches python dict.has_key() */
PyObject* CListValue::Pyhas_key(PyObject* value)
{
- if (PyString_Check(value) && FindValue((const char *)PyString_AsString(value)))
+ if (PyUnicode_Check(value) && FindValue((const char *)_PyUnicode_AsString(value)))
Py_RETURN_TRUE;
Py_RETURN_FALSE;