gdb/python: fix memory leak of gdb.Color objects

I noticed that this commit:

  commit 6447969d0ac774b6dec0f95a0d3d27c27d158690
  Date:   Sat Oct 5 22:27:44 2024 +0300

      Add an option with a color type.

has an unnecessary `Py_INCREF (self);` in gdb.Color.__init__.  This
means that the reference count on all gdb.Color objects (that pass
through __init__) will be +1 from where they should normally be, and
this will stop the gdb.Color objects from being deallocated.

Fix by removing the Py_INCREF call.

Add a test which exposes the memory leak.

Approved-By: Tom Tromey <tom@tromey.com>
3 files changed