summaryrefslogtreecommitdiff
path: root/libstdc++-v3/python
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-22 12:33:15 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-22 12:33:15 +0000
commit7fe76953bc950347fd9ffe87ce65db7bd2c08836 (patch)
treed7291e3d4d1965db44c60d0a07ed5d63765e5d8e /libstdc++-v3/python
parent2220c82c8a2c1e2e777634e3eaaceec6c607ecd1 (diff)
downloadgcc-7fe76953bc950347fd9ffe87ce65db7bd2c08836.tar.gz
PR libstdc++/48362
* python/libstdcxx/v6/printers.py (StdTuplePrinter): Handle empty tuples. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182620 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/python')
-rw-r--r--libstdc++-v3/python/libstdcxx/v6/printers.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index 241ae042fe6..4197c081d9c 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -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: