Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH] [gdb/python] Boolify gdb_python_initialized
Date: Sun, 24 May 2026 14:30:22 +0200	[thread overview]
Message-ID: <20260524123022.1211375-1-tdevries@suse.de> (raw)

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.
---
 gdb/python/python-internal.h | 2 +-
 gdb/python/python.c          | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 82f3262ae07..10c984bad4b 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -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;
diff --git a/gdb/python/python.c b/gdb/python/python.c
index fd254a340d8..e6d58f2f16a 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -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[] =

base-commit: c5590002d8ee23c8ee3d64803e4e03c5992903c1
-- 
2.51.0


             reply	other threads:[~2026-05-24 12:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-24 12:30 Tom de Vries [this message]
2026-05-25  1:55 ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260524123022.1211375-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox