]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/python: remove Py_TPFLAGS_BASETYPE from gdb.Color
authorAndrew Burgess <aburgess@redhat.com>
Tue, 22 Apr 2025 17:01:07 +0000 (18:01 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Wed, 23 Apr 2025 14:46:22 +0000 (15:46 +0100)
commitbd7a2f22b11e37ce35c3a78f6fb54ef74270b903
tree648bf05447ae30e8e12a7dfeb071499f46a64188
parentdff7f6c72d05d8a378dc346e6900ba7c4eba759f
gdb/python: remove Py_TPFLAGS_BASETYPE from gdb.Color

Remove the Py_TPFLAGS_BASETYPE flag from the gdb.Color type.  This
effectively makes gdb.Color final; users can no longer create classes
that inherit from gdb.Color.

Right now I cannot think of any cases where inheritance would be
needed over composition for a simple type like gdb.Color.  If I'm
wrong, then it's easy to add Py_TPFLAGS_BASETYPE back in later, this
would be an extension of the API.  But it's much harder to remove the
flag later as that might break existing user code (note: there has
been no release of GDB yet that includes the gdb.Color type).

Introducing this restriction makes the next commit easier.

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