From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id A04813858D33 for ; Fri, 22 Dec 2023 19:16:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A04813858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A04813858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703272576; cv=none; b=AXE/sA7/uOAB4tLGPcdQBz5/a4B9VsdBFvhj3nDuGNlraxCf+pzznEw036Z0xqT75Mi32zeZMX2eQpdGZCaEthNXIVbdRPAq/zEJd05Su720Or4czqzo4FkSLyEdJamyYtij++ZmiSc5fsBOidYT8d2JTnxFY6rmGayamS2OTL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703272576; c=relaxed/simple; bh=Gd9iY+eqQqdCpyixdr8elcJE/3X+krqJhVuzeaRA2/E=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=VB9i2XWXFGk9HKtPGUklgZLNFyQNH3uaga+f/azU3iGXur5Mjn8Uybj1DsiIAKE+3hQqplDC2p3KcLHyX8AWN79taALZezz9w6cAnwJtWPY4BZqFJes+KlJQu6vHXvdQ1CLxzfh9gCXy9TuOXgxg6ml/VeybXCuFwNrc8QMtgBE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1703272575; bh=Gd9iY+eqQqdCpyixdr8elcJE/3X+krqJhVuzeaRA2/E=; h=Date:Subject:To:References:From:In-Reply-To:From; b=nCl9D5fLBfdYp1ISAt4avXqXL5NACT6h0/doHGeiUaU6duQsMs+FbjYeo334uVBMu G0hjIWLm/PxS8L1CUE7BdNUeLVPZ8mhk7BkSwNhBbWOQHSKP1PMtRHEPwdT5lZ7svk lCX3ZqeZTS2thvtvI8LM6Q27pQLsv9SqjSIYNRng= Received: from [10.0.0.170] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 20D471E0AC; Fri, 22 Dec 2023 14:16:15 -0500 (EST) Message-ID: Date: Fri, 22 Dec 2023 14:16:14 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Remove 'if' from GDB_PY_HANDLE_EXCEPTION To: Tom Tromey , gdb-patches@sourceware.org References: <20231222184451.218271-1-tom@tromey.com> Content-Language: fr From: Simon Marchi In-Reply-To: <20231222184451.218271-1-tom@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 12/22/23 13:44, Tom Tromey wrote: > 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. In infpy_write_memory for instance, GDB_PY_HANDLE_EXCEPTION is not called within the catch block. Is it normal? > --- > 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 You could update those comments, TRY_EXCEPT is stale too. Simon