Re: [PATCH v2 1/9] gdb: switch tuple object helpers to Python limited API equivalents

Tom Tromey
2026-03-03T18:10:26Z

>>>>> Matthieu Longo <matthieu.longo@arm.com> writes:

> * PyTuple_GET_ITEM -> PyTuple_GetItem
> * PyTuple_SET_ITEM -> PyTuple_SetItem
> * PyTuple_GET_SIZE -> PyTuple_Size

Thanks.

At first I thought:

> + gdbpy_ref<> bool_obj (PyBool_FromLong (is_a_field_of_this.type != NULL));
> + if (PyTuple_SetItem (ret_tuple.get (), 1, bool_obj.release ()) < 0)
> + return nullptr;

... this was wrong, but it turns out that PyBool_FromLong is infallible.

So I think this is ok.
Approved-By: Tom Tromey <tom@tromey.com>

Tom