aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/python.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-12-03 22:49:40 +0100
committerTom de Vries <tdevries@suse.de>2024-12-03 22:49:40 +0100
commitc9b37bc99776dd69ac0e53a1cf4829137fb69cce (patch)
treed7d24a79337d06bffd0e37ada7a3338e302e2481 /gdb/python/python.c
parent125f702105d1ee1fd111d370c6f99fbe96f63899 (diff)
downloadbinutils-c9b37bc99776dd69ac0e53a1cf4829137fb69cce.zip
binutils-c9b37bc99776dd69ac0e53a1cf4829137fb69cce.tar.gz
binutils-c9b37bc99776dd69ac0e53a1cf4829137fb69cce.tar.bz2
[gdb/python] Drop ATTRIBUTE_UNUSED on py_initialize_catch_abort
I added ATTRIBUTE_UNUSED to py_initialize_catch_abort as a quick fix to deal with it being unused for PY_VERSION_HEX >= 0x030a0000, but forgot to fix this before committing. Fix this now, by removing the attribute and using '#if PY_VERSION_HEX < 0x030a0000' instead. Tested on aarch64-linux. Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/python/python.c')
-rw-r--r--gdb/python/python.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c
index eb8d35f..738dba6 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -2300,6 +2300,12 @@ gdbpy_gdb_exiting (int exit_code)
gdbpy_print_stack ();
}
+/* Stand-in for Py_IsInitialized (). To be used because after a python fatal
+ error, no calls into Python are allowed. */
+
+static bool py_isinitialized = false;
+
+#if PY_VERSION_HEX < 0x030a0000
/* Signal handler to convert a SIGABRT into an exception. */
static void
@@ -2310,14 +2316,9 @@ catch_python_fatal (int signum)
throw_exception_sjlj (gdb_exception {RETURN_ERROR, GENERIC_ERROR});
}
-/* Stand-in for Py_IsInitialized (). To be used because after a python fatal
- error, no calls into Python are allowed. */
-
-static bool py_isinitialized = false;
-
/* Call Py_Initialize (), and return true if successful. */
-static bool ATTRIBUTE_UNUSED
+static bool
py_initialize_catch_abort ()
{
auto prev_handler = signal (SIGABRT, catch_python_fatal);
@@ -2335,6 +2336,7 @@ py_initialize_catch_abort ()
return py_isinitialized;
}
+#endif
/* Initialize python, either by calling Py_Initialize or
Py_InitializeFromConfig, and return true if successful. */