]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/python] Boolify gdb_python_initialized
authorTom de Vries <tdevries@suse.de>
Mon, 25 May 2026 06:47:40 +0000 (08:47 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 25 May 2026 06:47:40 +0000 (08:47 +0200)
I noticed that while gdb_python_initialized is an int, there's also an
assignment using false:
...
  gdb_python_initialized = false;
...

Fix this by converting gdb_python_initialized to bool type.

Approved-by: Kevin Buettner <kevinb@redhat.com>
gdb/python/python-internal.h
gdb/python/python.c

index 82f3262ae07927ad5c73e8290fa0ee12b3f6d4e1..10c984bad4b0d8351d9d9ac4b8c44990c199187e 100644 (file)
@@ -330,7 +330,7 @@ struct program_space;
 struct bpstat;
 struct inferior;
 
-extern int gdb_python_initialized;
+extern bool gdb_python_initialized;
 
 extern PyObject *gdb_module;
 extern PyObject *gdb_python_module;
index fd254a340d854d4a0123ee10550729f40b83692e..e6d58f2f16a70cc451f339c207c8c5d160738e7f 100644 (file)
@@ -82,7 +82,7 @@ static const char *gdbpy_should_print_stack = python_excp_message;
 /* True if Python has been successfully initialized, false
    otherwise.  */
 
-int gdb_python_initialized;
+bool gdb_python_initialized;
 
 extern PyMethodDef python_GdbMethods[];
 
@@ -2796,7 +2796,7 @@ do_start_initialization ()
   PyEval_SaveThread ();
 
   /* Only set this when initialization has succeeded.  */
-  gdb_python_initialized = 1;
+  gdb_python_initialized = true;
   return true;
 }
 
@@ -2819,7 +2819,7 @@ test_python ()
   bool saw_exception = false;
   {
     scoped_restore reset_gdb_python_initialized
-      = make_scoped_restore (&gdb_python_initialized, 0);
+      = make_scoped_restore (&gdb_python_initialized, false);
     try
       {
        CMD (output);
@@ -3123,7 +3123,7 @@ gdbpy_initialize (const struct extension_language_defn *extlang)
 static int
 gdbpy_initialized (const struct extension_language_defn *extlang)
 {
-  return gdb_python_initialized;
+  return gdb_python_initialized ? 1 : 0;
 }
 
 PyMethodDef python_GdbMethods[] =