From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 112826 invoked by alias); 17 Mar 2019 20:50:29 -0000 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 Received: (qmail 112813 invoked by uid 89); 17 Mar 2019 20:50:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=barisione, H*i:sk:E62C5EB, overall, H*f:sk:E62C5EB X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 17 Mar 2019 20:50:26 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB282C057F2B; Sun, 17 Mar 2019 20:50:24 +0000 (UTC) Received: from f29-4.lan (ovpn-117-11.phx2.redhat.com [10.3.117.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 689E85D704; Sun, 17 Mar 2019 20:50:24 +0000 (UTC) Date: Sun, 17 Mar 2019 20:50:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Cc: Marco Barisione Subject: Re: [PATCH] Add gdb.Value.format_string () Message-ID: <20190317135023.2e51944d@f29-4.lan> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-03/txt/msg00357.txt.bz2 Hi Marco, Overall, I like this patch. See below for my comments. Kevin On Sat, 16 Mar 2019 11:18:36 +0000 Marco Barisione wrote: > gdb/doc/ChangeLog: > > 2019-03-16 Marco Barisione > > * python.texi: Document gdb.Value.format_string () A period is needed at the end of this ChangeLog entry. > diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c > index dd6a536b6a..46a0f563e4 100644 > --- a/gdb/python/py-value.c > +++ b/gdb/python/py-value.c > @@ -588,6 +588,162 @@ valpy_string (PyObject *self, PyObject *args, PyObject *kw) > encoding, errors); > } > > +/* Given a Python object, copy its truth value to a C int (the value > + pointed by dest). > + If src_obj is NULL, then *dest is not modified. > + > + Return 1 in case of success, -1 otherwise. */ Why not use a bool return type to indicate success or failure? > + > +static int > +copy_py_bool_obj (int *dest, PyObject *src_obj) > +{ > + if (src_obj) > + { > + int cmp = PyObject_IsTrue (src_obj); > + if (cmp < 0) > + return -1; > + *dest = cmp; > + } > + > + return 1; > +}