RFC: prototype of C extensions using the Python limited API
Tom Tromey
tom@tromey.com
Thu Jun 18 20:46:09 GMT 2026
Matthieu> The prototype is organized as follows:
Matthieu> - include/
Matthieu> - py-ref.hpp: copied from GDB. Addition of a clear() method in gdbpy_ref_policy.
Do we really need this?
What if gdb_py_ref is a subclass that adds a custom method instead?
I still haven't really read the code. It's kind of difficult in this
form.
Matthieu> + gdbpy_heap_type: generic logic for dynamically-allocated types
Matthieu> (tp_traverse, tp_clear, tp_dealloc)
I don't understand why these can't just be methods of the implementation
class, by which I mean the subclasses of PyObject. If needed we could
make an intermediary base class that interposes between the
implementation and PyObject like
struct intermediary : public PyObject {};
struct type_object : public intermediary { ... }; // eg
Matthieu> I don't expect a thorough review of all the code, but a
Matthieu> validation of the approach.
I'll try to send more next week.
Tom
More information about the Gdb
mailing list