From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12198 invoked by alias); 10 Sep 2012 20:38:20 -0000 Received: (qmail 12190 invoked by uid 22791); 10 Sep 2012 20:38:19 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 Sep 2012 20:38:01 +0000 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 q8AKbxOA019243 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 10 Sep 2012 16:37:59 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8AKbw0J028881 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 10 Sep 2012 16:37:58 -0400 From: Tom Tromey To: Khoo Yit Phang Cc: GDB Patches Subject: Re: [RFC] Make python/lib/gdb and submodules proper Python modules References: Date: Mon, 10 Sep 2012 20:38:00 -0000 In-Reply-To: (Khoo Yit Phang's message of "Sun, 2 Sep 2012 23:44:10 -0400") Message-ID: <87obldbom1.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: 2012-09/txt/msg00141.txt.bz2 >>>>> "Yit" == Khoo Yit Phang writes: Yit> I found it strange that python/lib/gdb and its submodules aren't truly Yit> Python modules (e.g., the python/lib/gdb/__init__.py had to explicitly Yit> refer to the gdb module), so I've put together a patch that makes them Yit> proper Python modules. Seems reasonable to me. Thanks. Yit> Also, I've made a few other related Yit> changes: I removed gdb.PYTHONDIR which isn't necessary anymore since Yit> the same information is available via gdb.__file__, and moved the Yit> Python code from finish_python_initialization to Yit> python/lib/gdb/__init__.py. I think it would be good to restore this, as Doug said. I realize Python programs can adapt, but it is friendlier not to make them adapt. Yit> One caveat about this patch is that the data-directory must contain Yit> the gdb module, otherwise Python will not be fully initialized (with a Yit> warning) and Python support will be very limited (only the _gdb module Yit> will be available). I think this is probably ok. Yit> + if (gdb_python_module && PyObject_HasAttrString (gdb_python_module, "prompt_hook")) This line should probably split before the "&&". Tom