[binutils-gdb] [gdb/python] Boolify gdb_python_initialized
Tom de Vries via Gdb-cvs <[email protected]> Mon, 25 May 2026 06:47:44 +0000 (GMT)
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=565074f17c6d3849e8a496d5bd7fbf7147b134bf commit 565074f17c6d3849e8a496d5bd7fbf7147b134bf Author: Tom de Vries <[email protected]> Date: Mon May 25 08:47:40 2026 +0200 [gdb/python] Boolify gdb_python_initialized 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 <[email protected]> Diff: --- 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[] =