[PATCH] PR libstdc++/86112 fix printers for Python 2.6

Jonathan Wakely jwakely@redhat.com
Mon Jun 25 21:03:00 GMT 2018


Dict comprehensions are only supported since Python 2.7, so use an
alternative syntax that is backwards compatible.

	PR libstdc++/86112
	* python/libstdcxx/v6/printers.py (add_one_template_type_printer):
	Replace dict comprehension.

Tested x86_64-linux, committed to trunk.


-------------- next part --------------
commit dfea2551319c1a473f5d9016ff90be1a157d59e9
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Jun 25 21:59:28 2018 +0100

    PR libstdc++/86112 fix printers for Python 2.6
    
    Dict comprehensions are only supported since Python 2.7, so use an
    alternative syntax that is backwards compatible.
    
            PR libstdc++/86112
            * python/libstdcxx/v6/printers.py (add_one_template_type_printer):
            Replace dict comprehension.

diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index 45aaa1211ec..34d8b4e6606 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -1438,7 +1438,8 @@ def add_one_template_type_printer(obj, name, defargs):
     if _versioned_namespace:
         # Add second type printer for same type in versioned namespace:
         ns = 'std::' + _versioned_namespace
-        defargs = { n: d.replace('std::', ns) for n,d in defargs.items() }
+        # PR 86112 Cannot use dict comprehension here:
+        defargs = dict((n, d.replace('std::', ns)) for (n,d) in defargs.items())
         printer = TemplateTypePrinter(ns+name, defargs)
         gdb.types.register_type_printer(obj, printer)
 


More information about the Gcc-patches mailing list