PyObject *item = PySequence_GetItem(seq, i);
if (PyUnicode_Check(item)) {
jstring value = pythonStringAsJavaString(env, item);
+ Py_DECREF(item);
(*env)->SetObjectArrayElement(env, array, i, value);
}
else {
+ Py_DECREF(item);
throwPythonException(env, "List item not a string");
return NULL;
}
for (i = 0; i < jlen; i++) {
PyObject *item = PySequence_GetItem(seq, i);
if (PyFloat_Check(item)) {
- double value = PyFloat_AsDouble(item);
+ jdouble value = PyFloat_AsDouble(item);
+ Py_DECREF(item);
(*env)->SetDoubleArrayRegion(env, array, i, 1, &value);
}
else {
+ Py_DECREF(item);
throwPythonException(env, "List item not a floating point value");
return NULL;
}
for (i = 0; i < jlen; i++) {
PyObject *item = PySequence_GetItem(seq, i);
jobject object = pythonObjectAsObject(env, item);
+ Py_DECREF(item);
(*env)->SetObjectArrayElement(env, array, i, object);
}
PyObject *item = PySequence_GetItem(seq, i);
if (PyBool_Check(item)) {
jboolean value = item == Py_True;
+ Py_DECREF(item);
(*env)->SetBooleanArrayRegion(env, array, i, 1, &value);
}
else {
+ Py_DECREF(item);
throwPythonException(env, "List item not a boolean");
return NULL;
}
PyObject *item = PySequence_GetItem(seq, i);
if (PyLong_Check(item)) {
jint value = PyLong_AsLong(item);
+ Py_DECREF(item);
(*env)->SetIntArrayRegion(env, array, i, 1, &value);
}
else {
+ Py_DECREF(item);
throwPythonException(env, "List item not an integer");
return NULL;
}
PyObject *item = PySequence_GetItem(seq, i);
if (PyLong_Check(item)) {
jlong value = PyLong_AsLongLong(item);
+ Py_DECREF(item);
(*env)->SetLongArrayRegion(env, array, i, 1, &value);
}
else {
+ Py_DECREF(item);
throwPythonException(env, "List item not an integer");
return NULL;
}