This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[patch, libstdc++] Use explicit relative imports for the pretty printers
- From: Matthias Klose <doko at ubuntu dot com>
- To: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, "gcc-patches at gnu dot org" <gcc-patches at gnu dot org>
- Cc: Siva Chandra Reddy <sivachandra at google dot com>
- Date: Wed, 25 Feb 2015 21:22:05 +0100
- Subject: [patch, libstdc++] Use explicit relative imports for the pretty printers
- Authentication-results: sourceware.org; auth=none
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())