re PR libstdc++/48362 (pretty printer fails for zero-size std::tuple<>)

PR libstdc++/48362
	* python/libstdcxx/v6/printers.py (StdTuplePrinter): Handle empty
	tuples.

From-SVN: r182620
This commit is contained in:
Jonathan Wakely 2011-12-22 12:33:15 +00:00 committed by Jonathan Wakely
parent 2d1debf816
commit 9dacb44bf1
2 changed files with 12 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2011-12-22 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/48362
* python/libstdcxx/v6/printers.py (StdTuplePrinter): Handle empty
tuples.
2011-12-20 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/51365

View File

@ -251,11 +251,11 @@ class StdTuplePrinter:
# Set the base class as the initial head of the
# tuple.
nodes = self.head.type.fields ()
if len (nodes) != 1:
if len (nodes) == 1:
# Set the actual head to the first pair.
self.head = self.head.cast (nodes[0].type)
elif len (nodes) != 0:
raise ValueError, "Top of tuple tree does not consist of a single node."
# Set the actual head to the first pair.
self.head = self.head.cast (nodes[0].type)
self.count = 0
def __iter__ (self):
@ -297,6 +297,8 @@ class StdTuplePrinter:
return self._iterator (self.val)
def to_string (self):
if len (self.val.type.fields ()) == 0:
return 'empty %s' % (self.typename)
return '%s containing' % (self.typename)
class StdStackOrQueuePrinter: