use Py_ssize_t rather than int when dealing with list sizes (original patch from Fedora but applied changes elsewhere too), also replace PyList_Size with PyList_GET_SIZE where typechecking is already done.

This commit is contained in:
2011-09-06 23:46:20 +00:00
parent 9baff83d72
commit 9161d3ce4b
8 changed files with 21 additions and 20 deletions

View File

@@ -725,7 +725,7 @@ static PyObject *gLibNew(PyObject*, PyObject* args)
if(idcode==ID_ME) {
PyObject *ret= PyList_New(0);
PyObject *item;
for(int i= 0; i < PyList_GET_SIZE(names); i++) {
for(Py_ssize_t i= 0; i < PyList_GET_SIZE(names); i++) {
name= _PyUnicode_AsString(PyList_GET_ITEM(names, i));
if(name) {
RAS_MeshObject *meshobj= kx_scene->GetSceneConverter()->ConvertMeshSpecial(kx_scene, maggie, name);
@@ -1751,7 +1751,7 @@ static void initPySysObjects(Main *maggie)
initPySysObjects__append(sys_path, gp_GamePythonPath);
// fprintf(stderr, "\nNew Path: %d ", PyList_Size(sys_path));
// fprintf(stderr, "\nNew Path: %d ", PyList_GET_SIZE(sys_path));
// PyObject_Print(sys_path, stderr, 0);
}
@@ -1775,7 +1775,7 @@ static void restorePySysObjects(void)
gp_OrigPythonSysModules= NULL;
// fprintf(stderr, "\nRestore Path: %d ", PyList_Size(sys_path));
// fprintf(stderr, "\nRestore Path: %d ", PyList_GET_SIZE(sys_path));
// PyObject_Print(sys_path, stderr, 0);
}