From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18105 invoked by alias); 24 Oct 2011 16:00:42 -0000 Received: (qmail 18058 invoked by uid 22791); 24 Oct 2011 16:00:37 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from qmta09.emeryville.ca.mail.comcast.net (HELO qmta09.emeryville.ca.mail.comcast.net) (76.96.30.96) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 24 Oct 2011 16:00:22 +0000 Received: from omta08.emeryville.ca.mail.comcast.net ([76.96.30.12]) by qmta09.emeryville.ca.mail.comcast.net with comcast id ofzy1h00A0FhH24A9g0Emp; Mon, 24 Oct 2011 16:00:14 +0000 Received: from [10.127.238.91] ([65.206.2.68]) by omta08.emeryville.ca.mail.comcast.net with comcast id ofza1h01Z1U2a2h8Ufzhon; Mon, 24 Oct 2011 15:59:49 +0000 Subject: Re: [python] [patch] PR python/13331 Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Paul Koning In-Reply-To: Date: Mon, 24 Oct 2011 16:06:00 -0000 Cc: gdb-patches@sourceware.org, Tom Tromey Content-Transfer-Encoding: quoted-printable Message-Id: <997BB236-D42C-42E5-B722-6045A84380CB@comcast.net> References: <09787EF419216C41A903FD14EE5506DD030CE5E15C@AUSX7MCPC103.AMER.DELL.COM> <966B9848-BA1E-4777-BCE3-FD57AEA6E989@comcast.net> To: pmuldoon@redhat.com Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00642.txt.bz2 On Oct 24, 2011, at 11:51 AM, Phil Muldoon wrote: > Paul Koning writes: >=20 >>> ... On the other hand, there is >> missing cleanup: any objects added to the tuple before the failing >> call need to have a DECREF done on them. >=20 > I'm not sure what you mean by this. If result fails, the args check in > the calling function will fail, the exception converted to a gdb_error, > the exception bits cleared and the call will fail. The loop will not be > executed. It is also my understanding that PyTuple_SetItem steals a > reference to the object being added. In this case, there is only one > reference to the object, so the logic here works. When the tuple is > garbage collected, the reference count for each object will > automatically be decremented and therefore garbage collected too. Yes, I got confused. Sorry. > ... >>=20 >> That should just be a cleanup and return NULL -- the >> PyObject_GetAttrString has set the exception. >=20 > Well yes and no, it is seemly expedient here to short-circuit the > process and convert it to a gdb error directly. The error is more > informative than the error from GetAttrString -- that is there is no > "invoke" function. This is something we (as in GDB), want to enforce in > our API I see what you mean, that makes sense. Keep the original exception unless = there is a reason to replace it -- for example to add more detail or make i= t more descriptive. paul