This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, I found it strange that python/lib/gdb and its submodules aren't truly Python modules (e.g., the python/lib/gdb/__init__.py had to explicitly refer to the gdb module), so I've put together a patch that makes them proper Python modules. This patch works by splitting out the gdb module into _gdb for the native code extensions (as recommended by PEP8), setting up sys.path in finish_python_initialization and finally loading the gdb module, as well as switching from using exec to reload/__import__ (which updates/creates Python modules). Also, I've made a few other related changes: I removed gdb.PYTHONDIR which isn't necessary anymore since the same information is available via gdb.__file__, and moved the Python code from finish_python_initialization to python/lib/gdb/__init__.py. One caveat about this patch is that the data-directory must contain the gdb module, otherwise Python will not be fully initialized (with a warning) and Python support will be very limited (only the _gdb module will be available). I've ran the testsuite on Ubuntu 11.04 with Python 2.7.1 and Python 2.4.6 and found no regressions (you may need the patch I recently posted that adds -nx to a few tests to avoid spurious results). What do you think? Thanks, Yit September 2, 2012
Attachment:
python-gdb-native-module.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |