From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7615 invoked by alias); 9 Apr 2009 15:44:34 -0000 Received: (qmail 7596 invoked by uid 22791); 9 Apr 2009 15:44:31 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,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; Thu, 09 Apr 2009 15:44:23 +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 n39FiIKj018533; Thu, 9 Apr 2009 11:44:18 -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 n39FiJFK007041; Thu, 9 Apr 2009 11:44:19 -0400 Received: from opsy.redhat.com (vpn-13-49.rdu.redhat.com [10.11.13.49]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n39FiHsv032509; Thu, 9 Apr 2009 11:44:17 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 82CB23781B3; Thu, 9 Apr 2009 09:44:15 -0600 (MDT) To: Thiago Jung Bauermann Cc: gdb-patches ml Subject: Re: Python pretty-printing [5/6] References: <1238863179.3236.134.camel@localhost.localdomain> <1239289186.30578.18.camel@localhost.localdomain> From: Tom Tromey Reply-To: Tom Tromey Date: Thu, 09 Apr 2009 15:44:00 -0000 In-Reply-To: <1239289186.30578.18.camel@localhost.localdomain> (Thiago Jung Bauermann's message of "Thu\, 09 Apr 2009 11\:59\:45 -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/msg00176.txt.bz2 >>>>> "Thiago" == Thiago Jung Bauermann writes: Thiago> I found one potential problem, which could cause the function to return Thiago> NULL without an exception being set (it's not the case I thought of Thiago> before, I think): suppose there's no objfile Python object when this Thiago> function is called, to the ALL_OBJFILES loop will skip all objs, then Thiago> the gdb module has no pretty_printers attribute, or the pretty_printers Thiago> value is not a list object. In that case, the function will return NULL Thiago> without a Python exception being set. Can it happen? Yes, I see it now: /* Fetch the global pretty printer dictionary. */ if (! PyObject_HasAttrString (gdb_module, "pretty_printers")) goto done; That is the bad branch. Thanks. Also, I think here: PyObject *objf = objfile_to_objfile_object (obj); if (!objf) continue; ... we need to clear the python error. I will make the needed changes. Thiago> Also, I noticed that the function may return Py_None if no Thiago> pretty-printer is found, and the callers even expect that. The function Thiago> comment needs to be fixed then: Thanks. Tom