[2/2,gdb/python] Use GDB_PY_SET_HANDLE_EXCEPTION more often

Message ID 20240821165308.11295-2-tdevries@suse.de
State Committed
Headers
Series [1/2,gdb/python] Use GDB_PY_HANDLE_EXCEPTION more often |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Tom de Vries Aug. 21, 2024, 4:53 p.m. UTC
  I found a few more places where we can use GDB_PY_SET_HANDLE_EXCEPTION.

Tested on x86_64-linux.
---
 gdb/python/py-breakpoint.c | 3 +--
 gdb/python/py-cmd.c        | 3 +--
 gdb/python/py-param.c      | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)
  

Comments

Tom Tromey Aug. 23, 2024, 3:52 p.m. UTC | #1
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> I found a few more places where we can use GDB_PY_SET_HANDLE_EXCEPTION.

Looks good, thanks.
Approved-By: Tom Tromey <tom@tromey.com>

Tom
  

Patch

diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 0bb7d44cfea..37570576305 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -1054,8 +1054,7 @@  bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
   catch (const gdb_exception &except)
     {
       bppy_pending_object = NULL;
-      gdbpy_convert_exception (except);
-      return -1;
+      GDB_PY_SET_HANDLE_EXCEPTION (except);
     }
 
   BPPY_SET_REQUIRE_VALID ((gdbpy_breakpoint_object *) self);
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index f83b45dd210..2ce2c90d805 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -541,8 +541,7 @@  cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
     }
   catch (const gdb_exception &except)
     {
-      gdbpy_convert_exception (except);
-      return -1;
+      GDB_PY_SET_HANDLE_EXCEPTION (except);
     }
 
   return 0;
diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c
index 621f85da3f8..e7032f7758c 100644
--- a/gdb/python/py-param.c
+++ b/gdb/python/py-param.c
@@ -885,8 +885,7 @@  parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
   catch (const gdb_exception &except)
     {
       Py_DECREF (self);
-      gdbpy_convert_exception (except);
-      return -1;
+      GDB_PY_SET_HANDLE_EXCEPTION (except);
     }
 
   return 0;