summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-07-10 17:57:36 +0100
committerMichael Williamson <mike@zwobble.org>2026-07-10 17:57:36 +0100
commita98b7eccf5230a5cfe7c97e31cb0039ad956da4c (patch)
treece48c018782e1708121886601893bdd0a73eae1e
parent40f4b9da27f54b57cc682e5642a2b181d4488de8 (diff)
Get length once
-rw-r--r--jq.pyx3
1 files changed, 2 insertions, 1 deletions
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: