This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 2/4] Define gdb.Value(bufobj, type) constructor
On Tue, 19 Feb 2019 22:43:09 -0500
Simon Marchi <simon.marchi@polymtl.ca> wrote:
> > + if (TYPE_LENGTH (type) > py_buf.len)
> > + {
> > + PyErr_SetString (PyExc_TypeError,
> > + _("Size of type is larger than that of buffer object."));
> > + return nullptr;
> > + }
>
> Another small thing I didn't spot when reading v1: I think it would be
> more appropriate to raise a ValueError in this last case. TypeError
> would be if the arguments were of the wrong Python type, which is not
> the case here. It just happens that the value we handle is a (GDB)
> type, but that's not the same kind of type. If you do that change,
> don't forget to update the tests as well.
I've made that change and have updated the test also.
Kevin