[PATCH 2/2] gdb/python: Use tp_init instead of tp_new to setup gdb.Value
Tom Tromey
tom@tromey.com
Thu Nov 18 15:04:02 GMT 2021
>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes:
Andrew> The documentation suggests that we implement gdb.Value.__init__,
Andrew> however, this is not currently true, we really implement
Andrew> gdb.Value.__new__. This will cause confusion if a user tries to
Andrew> sub-class gdb.Value.
This all makes sense to me FWIW.
Andrew> /* Nor in the cached Python objects. */
Andrew> Py_XDECREF (self->address);
Andrew> + self->address = nullptr;
Andrew> +
Andrew> Py_XDECREF (self->type);
Andrew> + self->type = nullptr;
Andrew> +
Andrew> Py_XDECREF (self->dynamic_type);
Andrew> + self->dynamic_type = nullptr;
I don't think we use it much in gdb, but the Py_XDECREF + assign NULL
combo is Py_CLEAR.
https://docs.python.org/3/c-api/refcounting.html#c.Py_CLEAR
Tom
More information about the Gdb-patches
mailing list