diff options
author | Tom Tromey <tom@tromey.com> | 2016-05-23 10:45:55 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2016-05-23 10:52:10 -0400 |
commit | b7145a1d7227c7ddfea8051bef5d2e8a6301ad42 (patch) | |
tree | 685821463b986dcc06d2f54b564870c34d578cf7 | |
parent | 0ffb21d355bde6ac11e7871dc0bf79009a6471c3 (diff) | |
download | glib-b7145a1d7227c7ddfea8051bef5d2e8a6301ad42.tar.gz |
Rename gdb macros with `_gdb` suffix to avoid ns clashes
glib installs a gdb helper file named `glib.py`.
Then the "hook" file updates `sys.path` and does `import glib`.
This will fail if glib has already been imported into gdb, say
using `from gi.repository import GLib`. This is due to a namespace clash.
One fix would be to rename the gdb helper files to not clash with
other Python modules. This should be done for all such helper files.
https://bugzilla.gnome.org/show_bug.cgi?id=760186
-rw-r--r-- | glib/Makefile.am | 2 | ||||
-rw-r--r-- | glib/glib_gdb.py (renamed from glib/glib.py) | 0 | ||||
-rw-r--r-- | glib/libglib-gdb.py.in | 2 | ||||
-rw-r--r-- | gobject/Makefile.am | 2 | ||||
-rw-r--r-- | gobject/gobject_gdb.py (renamed from gobject/gobject.py) | 6 | ||||
-rw-r--r-- | gobject/libgobject-gdb.py.in | 2 |
6 files changed, 7 insertions, 7 deletions
diff --git a/glib/Makefile.am b/glib/Makefile.am index d2295cbc9..766f37309 100644 --- a/glib/Makefile.am +++ b/glib/Makefile.am @@ -477,7 +477,7 @@ dist-hook: $(BUILT_EXTRA_DIST) $(top_builddir)/build/win32/vs9/glib.vcproj $(top # install gdb scripts gdbdir = $(datadir)/glib-2.0/gdb -dist_gdb_SCRIPTS = glib.py +dist_gdb_SCRIPTS = glib_gdb.py libglib-gdb.py: libglib-gdb.py.in $(AM_V_GEN) $(SED) -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libglib-gdb.py.in > $(builddir)/libglib-gdb.py diff --git a/glib/glib.py b/glib/glib_gdb.py index 38f101ad5..38f101ad5 100644 --- a/glib/glib.py +++ b/glib/glib_gdb.py diff --git a/glib/libglib-gdb.py.in b/glib/libglib-gdb.py.in index 3e07c42df..ef395b580 100644 --- a/glib/libglib-gdb.py.in +++ b/glib/libglib-gdb.py.in @@ -6,5 +6,5 @@ dir_ = '@datadir@/glib-2.0/gdb' if not dir_ in sys.path: sys.path.insert(0, dir_) -from glib import register +from glib_gdb import register register (gdb.current_objfile ()) diff --git a/gobject/Makefile.am b/gobject/Makefile.am index 78bef1eaf..a72e39cab 100644 --- a/gobject/Makefile.am +++ b/gobject/Makefile.am @@ -261,7 +261,7 @@ distclean-local: # install gdb scripts gdbdir = $(datadir)/glib-2.0/gdb -dist_gdb_SCRIPTS = gobject.py +dist_gdb_SCRIPTS = gobject_gdb.py libgobject-gdb.py: libgobject-gdb.py.in $(AM_V_GEN) $(SED) -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libgobject-gdb.py.in > $(builddir)/libgobject-gdb.py diff --git a/gobject/gobject.py b/gobject/gobject_gdb.py index 2311d6c83..8c3022031 100644 --- a/gobject/gobject.py +++ b/gobject/gobject_gdb.py @@ -1,6 +1,6 @@ import os.path import gdb -import glib +import glib_gdb import sys if sys.version_info[0] >= 3: @@ -37,7 +37,7 @@ def g_type_to_name (gtype): else: typenode = lookup_fundamental_type (typenode) if typenode != None: - return glib.g_quark_to_string (typenode["qname"]) + return glib_gdb.g_quark_to_string (typenode["qname"]) return None def is_g_type_instance (val): @@ -161,7 +161,7 @@ class SignalFrame(FrameDecorator): def get_detailed_signal_from_frame(self, frame, signal): detail = self.read_var (frame, "detail") - detail = glib.g_quark_to_string (detail) + detail = glib_gdb.g_quark_to_string (detail) if detail is not None: return signal + ":" + detail else: diff --git a/gobject/libgobject-gdb.py.in b/gobject/libgobject-gdb.py.in index fbd4879e1..e8b9dee34 100644 --- a/gobject/libgobject-gdb.py.in +++ b/gobject/libgobject-gdb.py.in @@ -6,5 +6,5 @@ dir_ = '@datadir@/glib-2.0/gdb' if not dir_ in sys.path: sys.path.insert(0, dir_) -from gobject import register +from gobject_gdb import register register (gdb.current_objfile ()) |