From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 793 invoked by alias); 12 Sep 2013 07:57:00 -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 694 invoked by uid 89); 12 Sep 2013 07:56:59 -0000 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; Thu, 12 Sep 2013 07:56:59 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8C7utS3029178 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 12 Sep 2013 03:56:56 -0400 Received: from localhost.localdomain (ovpn-112-30.ams2.redhat.com [10.36.112.30]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8C7urcH007388; Thu, 12 Sep 2013 03:56:54 -0400 Message-ID: <523173C4.4060906@redhat.com> Date: Thu, 12 Sep 2013 07:57:00 -0000 From: Phil Muldoon MIME-Version: 1.0 To: Jan Kratochvil CC: Tom Tromey , "gdb-patches@sourceware.org" Subject: Re: python-2.4 compat. [Re: [patch][python] 1 of 5 - Frame filter Python C code changes.] References: <5187686B.5010809@redhat.com> <87txmfx2qd.fsf@fleche.redhat.com> <518BA33B.9030405@redhat.com> <87bo8kqj6c.fsf@fleche.redhat.com> <518CCF0C.6060704@redhat.com> <20130912073646.GB13948@host2.jankratochvil.net> In-Reply-To: <20130912073646.GB13948@host2.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00374.txt.bz2 On 12/09/13 08:36, Jan Kratochvil wrote: > On Fri, 10 May 2013 12:42:20 +0200, Phil Muldoon wrote: > [...] >> --- /dev/null >> +++ b/gdb/python/lib/gdb/command/frame_filters.py >> @@ -0,0 +1,461 @@ > [...] >> + for frame_filter in sorted_frame_filters: >> + name = frame_filter[0] >> + try: >> + priority = '{:<8}'.format( >> + str(gdb.frames.get_priority(frame_filter[1]))) >> + enabled = '{:<7}'.format( >> + self.enabled_string(gdb.frames.get_enabled(frame_filter[1]))) >> + except Exception as e: >> + print(" Error printing filter '"+name+"': "+str(e)) >> + else: >> + print(" %s %s %s" % (priority, enabled, name)) > (plus it is there once again later) > > CentOS-5 python-2.4.3-56.el5.x86_64: > > ./gdb -nx -data-directory ./data-directoryTraceback (most recent call last): > File ".../gdb/testsuite/../data-directory/python/gdb/__init__.py", line 105, in auto_load_packages > __import__(modname) > File "./data-directory/python/gdb/command/frame_filters.py", line 82 > except Exception as e: > ^ > SyntaxError: invalid syntax > > GNU gdb (GDB) 7.6.50.20130912-cvs > > IIRC it was agreed upon upstream FSF GDB should support python-2.4, could you > code it in a compatible way? To write this so it works in Python 2.4 -> Python 3.x I will have to write it as: except Exception: e = sys.exc_info()[1] .... That's fine - I will do that. But I think it is kind of silly to do stuff like this in Python - we are just circumventing how Exceptions should be written to support a broad subset of Python versions. The differences between 2.4 and 2.7, and 3.x and everything in-between are just becoming a major pain to maintain, and harder to review. At some point we should discuss, for future GDB releases, our strategy for Python versions. I just see in the future incompatibilities we can't write around being replaced with: if sys.version >= 2.4 and sys.version <= 2.7: .... else if sys.version > 2.7: .... Which is just the moral equivalent of #ifdef'ness in C. Not to mention the same equivalent in the Python C code in GDB. Cheers, Phil