From a98b7eccf5230a5cfe7c97e31cb0039ad956da4c Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 10 Jul 2026 17:57:36 +0100 Subject: Get length once --- jq.pyx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jq.pyx b/jq.pyx index 2780a53..f57722f 100644 --- a/jq.pyx +++ b/jq.pyx @@ -105,7 +105,8 @@ cdef object _jv_to_python(jv value): python_value = jv_string_to_py_string(value) elif kind == JV_KIND_ARRAY: python_value = [] - for idx in range(0, jv_array_length(jv_copy(value))): + length = jv_array_length(jv_copy(value)) + for idx in range(0, length): property_value = jv_array_get(jv_copy(value), idx) python_value.append(_jv_to_python(property_value)) elif kind == JV_KIND_OBJECT: -- cgit v1.2.3