public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/58962] New: Pretty printers use obsolete Python syntax
@ 2013-11-01 14:26 bmerry at gmail dot com
  2013-11-01 14:31 ` [Bug libstdc++/58962] " bmerry at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: bmerry at gmail dot com @ 2013-11-01 14:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58962

            Bug ID: 58962
           Summary: Pretty printers use obsolete Python syntax
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bmerry at gmail dot com

Created attachment 31135
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31135&action=edit
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.


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

* [Bug libstdc++/58962] Pretty printers use obsolete Python syntax
  2013-11-01 14:26 [Bug libstdc++/58962] New: Pretty printers use obsolete Python syntax bmerry at gmail dot com
@ 2013-11-01 14:31 ` bmerry at gmail dot com
  2014-05-16 14:07 ` gonzalo.bonigo at tallertechnologies dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bmerry at gmail dot com @ 2013-11-01 14:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58962

--- Comment #1 from Bruce Merry <bmerry at gmail dot com> ---
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.


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

* [Bug libstdc++/58962] Pretty printers use obsolete Python syntax
  2013-11-01 14:26 [Bug libstdc++/58962] New: Pretty printers use obsolete Python syntax bmerry at gmail dot com
  2013-11-01 14:31 ` [Bug libstdc++/58962] " bmerry at gmail dot com
@ 2014-05-16 14:07 ` gonzalo.bonigo at tallertechnologies dot com
  2014-05-16 14:23 ` daniel.gutson at tallertechnologies dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gonzalo.bonigo at tallertechnologies dot com @ 2014-05-16 14:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58962

GonzaloBonigo <gonzalo.bonigo at tallertechnologies dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gonzalo.bonigo@tallertechno
                   |                            |logies.com

--- Comment #2 from GonzaloBonigo <gonzalo.bonigo at tallertechnologies dot com> ---
Please, assign it to me.


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

* [Bug libstdc++/58962] Pretty printers use obsolete Python syntax
  2013-11-01 14:26 [Bug libstdc++/58962] New: Pretty printers use obsolete Python syntax bmerry at gmail dot com
  2013-11-01 14:31 ` [Bug libstdc++/58962] " bmerry at gmail dot com
  2014-05-16 14:07 ` gonzalo.bonigo at tallertechnologies dot com
@ 2014-05-16 14:23 ` daniel.gutson at tallertechnologies dot com
  2014-05-16 14:26 ` bmerry at gmail dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: daniel.gutson at tallertechnologies dot com @ 2014-05-16 14:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58962

--- Comment #3 from Daniel Gutson <daniel.gutson at tallertechnologies dot com> ---
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.


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

* [Bug libstdc++/58962] Pretty printers use obsolete Python syntax
  2013-11-01 14:26 [Bug libstdc++/58962] New: Pretty printers use obsolete Python syntax bmerry at gmail dot com
                   ` (2 preceding siblings ...)
  2014-05-16 14:23 ` daniel.gutson at tallertechnologies dot com
@ 2014-05-16 14:26 ` bmerry at gmail dot com
  2014-07-11 13:44 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bmerry at gmail dot com @ 2014-05-16 14:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58962

--- Comment #4 from Bruce Merry <bmerry at gmail dot com> ---
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.


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

* [Bug libstdc++/58962] Pretty printers use obsolete Python syntax
  2013-11-01 14:26 [Bug libstdc++/58962] New: Pretty printers use obsolete Python syntax bmerry at gmail dot com
                   ` (3 preceding siblings ...)
  2014-05-16 14:26 ` bmerry at gmail dot com
@ 2014-07-11 13:44 ` redi at gcc dot gnu.org
  2014-07-11 14:12 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2014-07-11 13:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58962

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
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  <naesten@gmail.com>
        Matthias Klose  <doko@ubuntu.com>

    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


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

* [Bug libstdc++/58962] Pretty printers use obsolete Python syntax
  2013-11-01 14:26 [Bug libstdc++/58962] New: Pretty printers use obsolete Python syntax bmerry at gmail dot com
                   ` (4 preceding siblings ...)
  2014-07-11 13:44 ` redi at gcc dot gnu.org
@ 2014-07-11 14:12 ` redi at gcc dot gnu.org
  2014-08-04 18:51 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2014-07-11 14:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58962

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.10.0

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The trunk version of the printers should now work with both Python 2 and 3


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

* [Bug libstdc++/58962] Pretty printers use obsolete Python syntax
  2013-11-01 14:26 [Bug libstdc++/58962] New: Pretty printers use obsolete Python syntax bmerry at gmail dot com
                   ` (5 preceding siblings ...)
  2014-07-11 14:12 ` redi at gcc dot gnu.org
@ 2014-08-04 18:51 ` redi at gcc dot gnu.org
  2014-08-04 18:57 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2014-08-04 18:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58962

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
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  <naesten@gmail.com>

    Backport r212453 from trunk
    2014-07-11  Samuel Bronson  <naesten@gmail.com>
            Matthias Klose  <doko@ubuntu.com>

    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  <jwakely@redhat.com>

    * 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


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

* [Bug libstdc++/58962] Pretty printers use obsolete Python syntax
  2013-11-01 14:26 [Bug libstdc++/58962] New: Pretty printers use obsolete Python syntax bmerry at gmail dot com
                   ` (6 preceding siblings ...)
  2014-08-04 18:51 ` redi at gcc dot gnu.org
@ 2014-08-04 18:57 ` redi at gcc dot gnu.org
  2014-08-28 16:23 ` redi at gcc dot gnu.org
  2014-08-28 16:28 ` redi at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2014-08-04 18:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58962

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.10.0                      |4.9.2

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
backported for 4.9.2


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

* [Bug libstdc++/58962] Pretty printers use obsolete Python syntax
  2013-11-01 14:26 [Bug libstdc++/58962] New: Pretty printers use obsolete Python syntax bmerry at gmail dot com
                   ` (7 preceding siblings ...)
  2014-08-04 18:57 ` redi at gcc dot gnu.org
@ 2014-08-28 16:23 ` redi at gcc dot gnu.org
  2014-08-28 16:28 ` redi at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2014-08-28 16:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58962

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
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  <naesten@gmail.com>

    Backport r212453 from trunk
    2014-07-11  Samuel Bronson  <naesten@gmail.com>
            Matthias Klose  <doko@ubuntu.com>

    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  <jwakely@redhat.com>

    * 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


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

* [Bug libstdc++/58962] Pretty printers use obsolete Python syntax
  2013-11-01 14:26 [Bug libstdc++/58962] New: Pretty printers use obsolete Python syntax bmerry at gmail dot com
                   ` (8 preceding siblings ...)
  2014-08-28 16:23 ` redi at gcc dot gnu.org
@ 2014-08-28 16:28 ` redi at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2014-08-28 16:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58962

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.9.2                       |4.8.4


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

end of thread, other threads:[~2014-08-28 16:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-01 14:26 [Bug libstdc++/58962] New: Pretty printers use obsolete Python syntax bmerry at gmail dot com
2013-11-01 14:31 ` [Bug libstdc++/58962] " bmerry at gmail dot com
2014-05-16 14:07 ` gonzalo.bonigo at tallertechnologies dot com
2014-05-16 14:23 ` daniel.gutson at tallertechnologies dot com
2014-05-16 14:26 ` bmerry at gmail dot com
2014-07-11 13:44 ` redi at gcc dot gnu.org
2014-07-11 14:12 ` redi at gcc dot gnu.org
2014-08-04 18:51 ` redi at gcc dot gnu.org
2014-08-04 18:57 ` redi at gcc dot gnu.org
2014-08-28 16:23 ` redi at gcc dot gnu.org
2014-08-28 16:28 ` redi at gcc dot gnu.org

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