This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

[patch, libstdc++] Use explicit relative imports for the pretty printers


When gdb is linked/used with Python 3, import of the pretty printers fails:

Traceback (most recent call last):
 File
"/usr/share/gdb/auto-load/usr/lib/i386-linux-gnu/libstdc++.so.6.0.21-gdb.py",
line 58, in <module>
   import libstdcxx.v6
 File
"/usr/lib/i386-linux-gnu/../../share/gcc-5/python/libstdcxx/v6/__init__.py",
line 19, in <module>
   from printers import register_libstdcxx_printers
ImportError: No module named 'printers'
[Inferior 1 (process 6130) exited normally]

Python3 doesn't support implicit relative imports anymore.  Use explicit
relative imports instead.  This syntax is compatible with Python 2.5 and newer
2.x versions.  Ok for the trunk?

  Matthias


2015-02-25  Matthias Klose  <doko@ubuntu.com>

	* python/libstdcxx/v6/__init__.py: Use explicit relative imports.

Index: libstdc++-v3/python/libstdcxx/v6/__init__.py
===================================================================
--- libstdc++-v3/python/libstdcxx/v6/__init__.py	(revision 220970)
+++ libstdc++-v3/python/libstdcxx/v6/__init__.py	(working copy)
@@ -16,7 +16,7 @@
 import gdb

 # Load the pretty-printers.
-from printers import register_libstdcxx_printers
+from .printers import register_libstdcxx_printers
 register_libstdcxx_printers(gdb.current_objfile())

 # Load the xmethods if GDB supports them.
@@ -28,5 +28,5 @@
         return False

 if gdb_has_xmethods():
-    from xmethods import register_libstdcxx_xmethods
+    from .xmethods import register_libstdcxx_xmethods
     register_libstdcxx_xmethods(gdb.current_objfile())


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]