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

Bug #1256419 reported by Nelson Elhage
58
This bug affects 18 people
Affects Status Importance Assigned to Milestone
gcc
Unknown
Unknown
gcc-4.8 (Debian)
Fix Released
Unknown
gcc-4.8 (Ubuntu)
Fix Released
Medium
Unassigned
Trusty
Fix Released
Medium
Unassigned
gcc-4.9 (Debian)
Fix Released
Unknown
gcc-4.9 (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Ubuntu builds gdb's Python support against Python 3, but the STL pretty-printers shipped with libstdc++ don't support Python 3:

(gdb) python
>import os, sys
>stldir = '/usr/share/gcc-4.7/python/'
>if os.path.isdir(stldir):
> sys.path.insert(0, stldir)
> from libstdcxx.v6.printers import register_libstdcxx_printers
> register_libstdcxx_printers (None)
>end
Traceback (most recent call last):
  File "<string>", line 5, in <module>
  File "/usr/share/gcc-4.7/python/libstdcxx/v6/printers.py", line 45
    raise ValueError, "Cannot find type %s::%s" % (str(orig), name)
                    ^
SyntaxError: invalid syntax
Error while executing Python code.

ProblemType: Bug
DistroRelease: Ubuntu 13.10
Package: gcc-4.8 4.8.1-10ubuntu9
ProcVersionSignature: Ubuntu 3.11.0-13.20-generic 3.11.6
Uname: Linux 3.11.0-13-generic x86_64
ApportVersion: 2.12.5-0ubuntu2.1
Architecture: amd64
Date: Fri Nov 29 15:06:03 2013
InstallationDate: Installed on 2012-12-02 (362 days ago)
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Release amd64 (20121017.5)
MarkForUpload: True
SourcePackage: gcc-4.8
UpgradeStatus: Upgraded to saucy on 2013-10-19 (41 days ago)

Revision history for this message
Nelson Elhage (nelhage) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gcc-4.8 (Ubuntu):
status: New → Confirmed
Revision history for this message
Pascal Giard (pascalgiard-debian) wrote :

Thanks to 2to3 and minor manual modifications, I got the libstdc++ pretty printers to work with Python3. In case it can be useful to others:
http://organact.mine.nu/dokuwiki/_media/astuces:printers.py.xz

Revision history for this message
kajokeji (kajokeji-2013) wrote :

Thank you Pascal. YES it was very useful !

Ryan Tandy (rtandy)
Changed in gdb (Ubuntu):
status: New → Confirmed
tags: added: trusty
Changed in gcc-4.9 (Debian):
status: Unknown → New
Changed in gcc-4.9 (Debian):
status: New → Fix Released
Revision history for this message
Rüdiger Sonderfeld (ruediger-c-plusplus) wrote :

Debian has also fixed this for gcc-4.8. Please apply the change to Ubuntu as well.

http://metadata.ftp-master.debian.org/changelogs//main/g/gcc-4.8/gcc-4.8_4.8.2-23_changelog

gcc-4.8 (4.8.2-23)
> * Update the libstdc++v-python3 patch. Closes: #748317.

Ryan Tandy (rtandy)
no longer affects: gdb (Ubuntu)
Changed in gcc-4.9 (Ubuntu):
status: New → Fix Released
Changed in gcc-4.8 (Debian):
status: Unknown → Fix Released
Revision history for this message
Rüdiger Sonderfeld (ruediger-c-plusplus) wrote :
Revision history for this message
Matthias Klose (doko) wrote :

fixed in utopic

Changed in gcc-4.8 (Ubuntu Trusty):
status: New → In Progress
Changed in gcc-4.8 (Ubuntu):
status: Confirmed → Fix Released
Changed in gcc-4.9 (Ubuntu Trusty):
status: New → Invalid
Revision history for this message
ori (ori-livneh) wrote :

This has been fixed upstream: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58962
Could the fix be applied for trusty?

Revision history for this message
Simon Marchi (simon-marchi) wrote :

Given that trusty is an LTS, it would indeed be interesting to get this fixed. What is the procedure for this? Is there anything I can do to help?

Revision history for this message
Matthias Klose (doko) wrote :

fixed in trusty with the 4.8.4 backport

Changed in gcc-4.8 (Ubuntu Trusty):
status: In Progress → Fix Released
Revision history for this message
phil (fongpwf) wrote :

I don't understand the comment about the fix being in Trusty. I only see gcc 4.8.2 in Trusty. There's not 4.8.4 (yet). There's no gcc in trusty-backports either.

Mathew Hodson (mhodson)
no longer affects: gcc-4.9 (Ubuntu Trusty)
Revision history for this message
Mathew Hodson (mhodson) wrote :

Phil, the fix is in gcc-4.8 (4.8.4-2ubuntu1~14.04), which is available in trusty-updates.

Changed in gcc-4.8 (Ubuntu Trusty):
importance: Undecided → Medium
Changed in gcc-4.9 (Ubuntu):
importance: Undecided → Medium
Changed in gcc-4.8 (Ubuntu):
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.