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.

Reply via email to