[glib] Rename gdb macros with `_gdb` suffix to avoid ns clashes
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Rename gdb macros with `_gdb` suffix to avoid ns clashes
- Date: Mon, 23 May 2016 14:53:10 +0000 (UTC)
commit b7145a1d7227c7ddfea8051bef5d2e8a6301ad42
Author: Tom Tromey <tom tromey com>
Date: Mon May 23 10:45:55 2016 -0400
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
glib/Makefile.am | 2 +-
glib/{glib.py => glib_gdb.py} | 0
glib/libglib-gdb.py.in | 2 +-
gobject/Makefile.am | 2 +-
gobject/{gobject.py => gobject_gdb.py} | 6 +++---
gobject/libgobject-gdb.py.in | 2 +-
6 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/glib/Makefile.am b/glib/Makefile.am
index d2295cb..766f373 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
similarity index 100%
rename from glib/glib.py
rename to glib/glib_gdb.py
diff --git a/glib/libglib-gdb.py.in b/glib/libglib-gdb.py.in
index 3e07c42..ef395b5 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 78bef1e..a72e39c 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
similarity index 98%
rename from gobject/gobject.py
rename to gobject/gobject_gdb.py
index 2311d6c..8c30220 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 fbd4879..e8b9dee 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 ())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]