From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH] Remove 'if' from GDB_PY_HANDLE_EXCEPTION
Date: Fri, 22 Dec 2023 11:44:51 -0700 [thread overview]
Message-ID: <20231222184451.218271-1-tom@tromey.com> (raw)
This removes the embedded 'if' from GDB_PY_HANDLE_EXCEPTION and
GDB_PY_SET_HANDLE_EXCEPTION. I believe this 'if' was necessary with
the old gdb try/catch macros, but it no longer is: now these are only
ever called from a 'catch' block, where it's already known that an
exception was thrown.
---
gdb/python/python-internal.h | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 14e15574685..fc8430ff35a 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -800,22 +800,16 @@ class gdbpy_gil
exception. */
#define GDB_PY_HANDLE_EXCEPTION(Exception) \
do { \
- if (Exception.reason < 0) \
- { \
- gdbpy_convert_exception (Exception); \
- return NULL; \
- } \
+ gdbpy_convert_exception (Exception); \
+ return NULL; \
} while (0)
/* Use this after a TRY_EXCEPT to throw the appropriate Python
exception. This macro is for use inside setter functions. */
#define GDB_PY_SET_HANDLE_EXCEPTION(Exception) \
do { \
- if (Exception.reason < 0) \
- { \
- gdbpy_convert_exception (Exception); \
- return -1; \
- } \
+ gdbpy_convert_exception (Exception); \
+ return -1; \
} while (0)
int gdbpy_print_python_errors_p (void);
--
2.43.0
next reply other threads:[~2023-12-22 18:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-22 18:44 Tom Tromey [this message]
2023-12-22 19:16 ` Simon Marchi
2024-01-24 1:58 ` Tom Tromey
2024-03-14 15:02 ` Tom Tromey
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=20231222184451.218271-1-tom@tromey.com \
--to=tom@tromey.com \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).