From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14532 invoked by alias); 8 Apr 2009 18:26:26 -0000 Received: (qmail 14520 invoked by uid 22791); 8 Apr 2009 18:26:24 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_47,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 08 Apr 2009 18:26:18 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n38IQBB8029908; Wed, 8 Apr 2009 14:26:11 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n38IQBf3005455; Wed, 8 Apr 2009 14:26:12 -0400 Received: from opsy.redhat.com (vpn-14-2.rdu.redhat.com [10.11.14.2]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n38IQ8qN002402; Wed, 8 Apr 2009 14:26:10 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id E304D3781B3; Wed, 8 Apr 2009 12:26:06 -0600 (MDT) To: Thiago Jung Bauermann Cc: gdb-patches@sourceware.org Subject: Re: Python pretty-printing [3/6] References: <1238790861.3236.72.camel@localhost.localdomain> From: Tom Tromey Reply-To: Tom Tromey Date: Wed, 08 Apr 2009 18:26:00 -0000 In-Reply-To: <1238790861.3236.72.camel@localhost.localdomain> (Thiago Jung Bauermann's message of "Fri\, 03 Apr 2009 17\:34\:21 -0300") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2009-04/txt/msg00153.txt.bz2 >>>>> "Thiago" == Thiago Jung Bauermann writes: Tom> + if (except.reason < 0) Tom> + { Tom> + PyErr_Format (except.reason == RETURN_QUIT Tom> + ? PyExc_KeyboardInterrupt : PyExc_RuntimeError, Tom> + "%s", except.message); Tom> + return NULL; Tom> + } Thiago> Perhaps this is nitpicking, but: any reason why you don't use Thiago> GDB_PY_HANDLE_EXCEPTION here? This code seems to do the same thing. GDB_PY_HANDLE_EXCEPTION does "return PyErr_Format...", which means the return uses the wrong type. (I didn't see this at first either, I found out by trying :-) [ methods ] Thiago> I think most of these methods could be attributes instead. The ones Thiago> which should stay as methods are those who have side-effects (like Thiago> causing a symtab to be loaded, or somesuch). Even the methods which Thiago> create new types only do so if the requested type doesn't exist yet, Thiago> IIUC. Are there side-effects in, say, Type.pointer or Type.reference? I changed a few to be attributes: code, sizeof, and tag. The rest I left as methods. It seemed reasonable to me that requests for type variants (or pointer-to or reference-to or whatever) should be methods. They may cause a new type to be created. Tom