diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-07-10 18:28:28 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-07-10 18:28:28 +0100 |
| commit | c9c88166beaa21524ad7f31e1b15bee5d711b0c7 (patch) | |
| tree | 65647d7ea32681d5fc948b12d9e7de28955dec7f | |
| parent | 470252c221275cbc50d611a4186bd210904513f4 (diff) | |
Fix reference counting in _jq_error_to_py_string()
| -rw-r--r-- | jq.pyx | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -225,7 +225,9 @@ cdef void _store_error(void* store_ptr, jv error) noexcept: cdef unicode _jq_error_to_py_string(jv error) noexcept: - error = jv_copy(error) + """Convert a jq error into a Python string. + + Does not consume the input error.""" if jv_get_kind(error) == JV_KIND_STRING: try: @@ -233,7 +235,7 @@ cdef unicode _jq_error_to_py_string(jv error) noexcept: except: return u"Internal error" else: - return json.dumps(_jv_to_python(error)) + return json.dumps(_jv_to_python(jv_copy(error))) cdef class _ErrorStore(object): |
