Launchpad has imported 10 comments from the remote bug at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58962.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://documentation.ubuntu.com/launchpad/user/reference/bugs/multi-project-bugs/about-multi-project-bugs/#bugs-in-external-trackers.

------------------------------------------------------------------------
On 2013-11-01T14:26:33+00:00 Bruce Merry wrote:

Created attachment 31135
Patch to update raise statements to modern Python syntax

The pretty printers shipped with GCC 4.8.1 use the obsolete

raise ExceptionClass, argument

format for raising exceptions. Modern Python (not sure when it was
introduced, but the Python 2.6 docs seems to support it so it has been
around for a while) instead uses

raise ExceptionClass(arguments...)

and the old form is not supported in Python 3. The result is that when I
try to load the pretty printers via .gdbinit in Ubuntu 13.10, I get this
message:

Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/usr/share/gcc-4.8/python/libstdcxx/v6/printers.py", line 54
    raise ValueError, "Cannot find type %s::%s" % (str(orig), name)
                    ^
SyntaxError: invalid syntax
/home/bruce/.gdbinit:7: Error in sourced command file:
Error while executing Python code.

I've attached a patch which changes the raise statements to use the new
syntax. It's against the version shipped with Ubuntu 13.10 in
libstdc++6-4.8-dbg; I haven't checked whether Ubuntu have added their
own patches.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1256419/comments/0

------------------------------------------------------------------------
On 2013-11-01T14:31:34+00:00 Bruce Merry wrote:

I've now realised that this is actually just the tip of the iceberg - I
suspect that libstdc++'s pretty printers aren't Python 3 ready, while
Ubuntu is shipping a gdb linked to libython 3.3. Feel free to close if
this is as expected.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1256419/comments/1

------------------------------------------------------------------------
On 2014-05-16T14:07:35+00:00 Gonzalo-bonigo wrote:

Please, assign it to me.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1256419/comments/7

------------------------------------------------------------------------
On 2014-05-16T14:23:14+00:00 Daniel-gutson-2 wrote:

Please do not close this issue.(In reply to Bruce Merry from comment #1)
> I've now realised that this is actually just the tip of the iceberg - I
> suspect that libstdc++'s pretty printers aren't Python 3 ready, while Ubuntu
> is shipping a gdb linked to libython 3.3. Feel free to close if this is as
> expected.

Please don't close this issue, it is completely relevant since not only
for ubuntu but for other distros too.

Syntax should work both with python versions 2 and 3 at ever possible.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1256419/comments/8

------------------------------------------------------------------------
On 2014-05-16T14:26:42+00:00 Bruce Merry wrote:

Incidentally, the workaround I have been using is to just run the script
through 2to3. Since Python only tells you things have gone wrong when
you execute the code I can't guarantee that this fixes everything, but
I've yet to hit any further Python 2 vs 3 issues after doing this.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1256419/comments/9

------------------------------------------------------------------------
On 2014-07-11T13:43:42+00:00 Redi wrote:

Author: redi
Date: Fri Jul 11 13:43:07 2014
New Revision: 212453

URL: https://gcc.gnu.org/viewcvs?rev=212453&root=gcc&view=rev
Log:
2014-07-11  Samuel Bronson  <[email protected]>
            Matthias Klose  <[email protected]>

        PR libstdc++/58962
        * python/libstdcxx/v6/printers.py: Port to Python 2+3
        (imap): New compat function.
        (izip): Likewise.
        (Iterator): New mixin to allow writing iterators in Python 3 style
        regardless of which version we're running on.
        [Python3] (long) New compat alias for "int".
        * testsuite/lib/gdb-test.exp: Port to Python 2+3 (print syntax)

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/python/libstdcxx/v6/printers.py
    trunk/libstdc++-v3/testsuite/lib/gdb-test.exp

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1256419/comments/13

------------------------------------------------------------------------
On 2014-07-11T14:12:00+00:00 Redi wrote:

The trunk version of the printers should now work with both Python 2 and
3

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1256419/comments/14

------------------------------------------------------------------------
On 2014-08-04T18:51:03+00:00 Redi wrote:

Author: redi
Date: Mon Aug  4 18:50:30 2014
New Revision: 213604

URL: https://gcc.gnu.org/viewcvs?rev=213604&root=gcc&view=rev
Log:
2014-08-04  Samuel Bronson  <[email protected]>

        Backport r212453 from trunk
        2014-07-11  Samuel Bronson  <[email protected]>
                    Matthias Klose  <[email protected]>

        PR libstdc++/58962
        * python/libstdcxx/v6/printers.py: Port to Python 2+3
        (imap): New compat function.
        (izip): Likewise.
        (Iterator): New mixin to allow writing iterators in Python 3 style
        regardless of which version we're running on.
        [Python3] (long) New compat alias for "int".
        * testsuite/lib/gdb-test.exp: Port to Python 2+3 (print syntax)

        Backport r210625 from trunk
        2014-05-19  Jonathan Wakely  <[email protected]>

        * python/libstdcxx/v6/printers.py: Use Python3 raise syntax.

Modified:
    branches/gcc-4_9-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_9-branch/libstdc++-v3/python/libstdcxx/v6/printers.py
    branches/gcc-4_9-branch/libstdc++-v3/testsuite/lib/gdb-test.exp

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1256419/comments/15

------------------------------------------------------------------------
On 2014-08-04T18:57:27+00:00 Redi wrote:

backported for 4.9.2

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1256419/comments/16

------------------------------------------------------------------------
On 2014-08-28T16:22:54+00:00 Redi wrote:

Author: redi
Date: Thu Aug 28 16:22:21 2014
New Revision: 214682

URL: https://gcc.gnu.org/viewcvs?rev=214682&root=gcc&view=rev
Log:
2014-08-28  Samuel Bronson  <[email protected]>

        Backport r212453 from trunk
        2014-07-11  Samuel Bronson  <[email protected]>
                    Matthias Klose  <[email protected]>

        PR libstdc++/58962
        * python/libstdcxx/v6/printers.py: Port to Python 2+3
        (imap): New compat function.
        (izip): Likewise.
        (Iterator): New mixin to allow writing iterators in Python 3 style
        regardless of which version we're running on.
        [Python3] (long) New compat alias for "int".
        * testsuite/lib/gdb-test.exp: Port to Python 2+3 (print syntax)

        Backport r210625 from trunk
        2014-05-19  Jonathan Wakely  <[email protected]>

        * python/libstdcxx/v6/printers.py: Use Python3 raise syntax.

Modified:
    branches/gcc-4_8-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_8-branch/libstdc++-v3/python/libstdcxx/v6/printers.py
    branches/gcc-4_8-branch/libstdc++-v3/testsuite/lib/gdb-test.exp

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1256419/comments/17


** Changed in: gcc
       Status: Unknown => Fix Released

** Changed in: gcc
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1256419

Title:
  libstdc++ pretty-printers don't work with Python 3

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/1256419/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to