public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, libstdc++] Use explicit relative imports for the pretty printers
@ 2015-02-25 21:02 Matthias Klose
  2015-02-27 21:52 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Matthias Klose @ 2015-02-25 21:02 UTC (permalink / raw)
  To: libstdc++, gcc-patches; +Cc: Siva Chandra Reddy

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())

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch, libstdc++] Use explicit relative imports for the pretty printers
  2015-02-25 21:02 [patch, libstdc++] Use explicit relative imports for the pretty printers Matthias Klose
@ 2015-02-27 21:52 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2015-02-27 21:52 UTC (permalink / raw)
  To: Matthias Klose; +Cc: libstdc++, gcc-patches, Siva Chandra Reddy

On 25 February 2015 at 20:22, Matthias Klose wrote:
> 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?

OK, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-27 21:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 21:02 [patch, libstdc++] Use explicit relative imports for the pretty printers Matthias Klose
2015-02-27 21:52 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).