This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Make python/lib/gdb and submodules proper Python modules
- From: Tom Tromey <tromey at redhat dot com>
- To: Khoo Yit Phang <khooyp at cs dot umd dot edu>
- Cc: GDB Patches <gdb-patches at sourceware dot org>
- Date: Mon, 10 Sep 2012 14:37:58 -0600
- Subject: Re: [RFC] Make python/lib/gdb and submodules proper Python modules
- References: <A0A7E3CA-2749-46AF-929D-4DF9CC17E4BA@cs.umd.edu>
>>>>> "Yit" == Khoo Yit Phang <khooyp@cs.umd.edu> 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