py api cleanup, replace use...
- PyLong_FromSsize_t --> PyLong_FromLong - PyLong_AsSsize_t --> PyLong_AsLong In all places except for those where python api expects PySsize_t (index lookups mainly). - use PyBool_FromLong in a few areas of the BGE. - fix incorrect assumption in the BGE that PySequence_Check() means PySequence_Fast_ functions can be used.
This commit is contained in:
		@@ -83,13 +83,13 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
 | 
			
		||||
		/* could use is_double for 'long int' but no use now */
 | 
			
		||||
		int *array_int = array;
 | 
			
		||||
		for (i = 0; i < length; i++) {
 | 
			
		||||
			array_int[i] = PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i));
 | 
			
		||||
			array_int[i] = PyLong_AsLong(PySequence_Fast_GET_ITEM(value_fast, i));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	else if (type == &PyBool_Type) {
 | 
			
		||||
		int *array_bool = array;
 | 
			
		||||
		for (i = 0; i < length; i++) {
 | 
			
		||||
			array_bool[i] = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
 | 
			
		||||
			array_bool[i] = (PyLong_AsLong(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
@@ -567,7 +567,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
 | 
			
		||||
			ret = PyObject_CallFunction(calcsize, (char *)"s", format);
 | 
			
		||||
 | 
			
		||||
			if (ret) {
 | 
			
		||||
				sizes[i] = PyLong_AsSsize_t(ret);
 | 
			
		||||
				sizes[i] = PyLong_AsLong(ret);
 | 
			
		||||
				Py_DECREF(ret);
 | 
			
		||||
				ret = PyObject_CallFunction(unpack, (char *)"sy#", format, (char *)ptr, sizes[i]);
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user