Re: [PATCH v2 6/9] gdb/python: flatten functions calling PyObject_New and use gdbpy_ref

Tom Tromey
2026-03-03T18:23:01Z

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

> This patch aims at systematically using gdbpy_ref<> at all call sites
> of PyObject_New(). This prepares for future patches that expect
> gdbby_ref<> parameters and affect return handling.
> As part of this change, flattening the affected functions so that the
> return logic becomes clearer and more flexible to adjust.

Makes sense, thank you.

> - return gdbpy_ref<>::new_reference (result);
> + return gdbpy_ref<>::new_reference (object.release ());

If that other series goes in the '.release' can be dropped.

Tom