From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30368 invoked by alias); 26 Feb 2019 17:34: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 30324 invoked by uid 89); 26 Feb 2019 17:34:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS autolearn=no version=3.3.2 spammy=forget 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; Tue, 26 Feb 2019 17:34:26 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 843F32CD7E0; Tue, 26 Feb 2019 17:34:25 +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 5C12E5D9CC; Tue, 26 Feb 2019 17:34:25 +0000 (UTC) Date: Tue, 26 Feb 2019 17:34:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: Re: [PATCH v2 2/4] Define gdb.Value(bufobj, type) constructor Message-ID: <20190226103424.555025cf@f29-4.lan> In-Reply-To: <6e92c59bf470368dea2842e48254b8f8@polymtl.ca> References: <20190219143356.1576e67f@f29-4.lan> <20190219144158.7df6921b@f29-4.lan> <6e92c59bf470368dea2842e48254b8f8@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-02/txt/msg00442.txt.bz2 On Tue, 19 Feb 2019 22:43:09 -0500 Simon Marchi wrote: > > + if (TYPE_LENGTH (type) > py_buf.len) > > + { > > + PyErr_SetString (PyExc_TypeError, > > + _("Size of type is larger than that of buffer object.")); > > + return nullptr; > > + } > > Another small thing I didn't spot when reading v1: I think it would be > more appropriate to raise a ValueError in this last case. TypeError > would be if the arguments were of the wrong Python type, which is not > the case here. It just happens that the value we handle is a (GDB) > type, but that's not the same kind of type. If you do that change, > don't forget to update the tests as well. I've made that change and have updated the test also. Kevin