]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/python: missing PyObject_IsTrue error check in bppy_init
authorAndrew Burgess <aburgess@redhat.com>
Sun, 10 Nov 2024 19:58:25 +0000 (19:58 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Thu, 14 Nov 2024 19:34:44 +0000 (19:34 +0000)
commit8518ce5fc22fe33e1f6f698a26548edb1dcd2e74
tree8483c7532e8dc9b313674dcbaee6fcde54978f6a
parentad39b4aae84a224dc5451d6a5f707b1db67a7b7e
gdb/python: missing PyObject_IsTrue error check in bppy_init

As with the previous two commits, this commit fixes a location where
we called PyObject_IsTrue without including an error check, this time
in bppy_init.

The 'qualified' argument is supposed to be a bool, the docs say:

  The optional QUALIFIED argument is a boolean that allows
  interpreting the function passed in 'spec' as a fully-qualified
  name.  It is equivalent to 'break''s '-qualified' flag (*note
  Linespec Locations:: and *note Explicit Locations::).

It's not totally clear that the only valid values are True or False,
but I'm choosing to interpret the docs that way, and so I've added a
PyBool_Type check during argument parsing.  Now, if a non-bool is
passed the user will get a TypeError during argument parsing.  I've
added a test to cover this case.

This is a potentially breaking change to the Python API, but hopefully
this will not impact too many people.  I've added a NEWS entry to
highlight this change.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
gdb/NEWS
gdb/python/py-breakpoint.c
gdb/testsuite/gdb.python/py-breakpoint.exp