This is the mail archive of the mailing list for the libstdc++ project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Use Python3 raise syntax in printers

This is a partial patch to make the printers work with Python2 and
Python3, there are more changes needed but this bit is simple.

Tested x86_64-linux, committed to trunk.
commit 0f4c27366c14976900d0420c7c4318d6cc1cbf67
Author: Jonathan Wakely <>
Date:   Mon May 19 22:18:13 2014 +0100

    	* python/libstdcxx/v6/ Use Python3 raise syntax.

diff --git a/libstdc++-v3/python/libstdcxx/v6/ b/libstdc++-v3/python/libstdcxx/v6/
index 1f1f860..623a815 100644
--- a/libstdc++-v3/python/libstdcxx/v6/
+++ b/libstdc++-v3/python/libstdcxx/v6/
@@ -51,7 +51,7 @@ def find_type(orig, name):
         # anything fancier here.
         field = typ.fields()[0]
         if not field.is_base_class:
-            raise ValueError, "Cannot find type %s::%s" % (str(orig), name)
+            raise ValueError("Cannot find type %s::%s" % (str(orig), name))
         typ = field.type
 class SharedPointerPrinter:
@@ -276,7 +276,7 @@ class StdTuplePrinter:
                 # 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."
+                raise ValueError("Top of tuple tree does not consist of a single node.")
             self.count = 0
         def __iter__ (self):
@@ -289,7 +289,7 @@ class StdTuplePrinter:
                 raise StopIteration
             # Check that this iteration has an expected structure.
             if len (nodes) != 2:
-                raise ValueError, "Cannot parse more than 2 nodes in a tuple tree."
+                raise ValueError("Cannot parse more than 2 nodes in a tuple tree.")
             # - Left node is the next recursion parent.
             # - Right node is the actual class contained in the tuple.
@@ -389,7 +389,7 @@ def get_value_from_Rb_tree_node(node):
             return p.dereference()
-    raise ValueError, "Unsupported implementation for %s" % str(node.type)
+    raise ValueError("Unsupported implementation for %s" % str(node.type))
 # This is a pretty printer for std::_Rb_tree_iterator (which is
 # std::map::iterator), and has nothing to do with the RbtreeIterator
@@ -827,7 +827,7 @@ class Printer(object):
         # A small sanity check.
         # FIXME
         if not self.compiled_rx.match(name + '<>'):
-            raise ValueError, 'libstdc++ programming error: "%s" does not match' % name
+            raise ValueError('libstdc++ programming error: "%s" does not match' % name)
         printer = RxPrinter(name, function)
         self.lookup[name] = printer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]