[master] 840e966 python3 compatibility

guillaume quintard gquintard at users.noreply.github.com
Mon Dec 18 12:10:08 UTC 2017


commit 840e966daee16cbe6aed0d0a4b31ea40122f8061
Author: Guillaume Quintard <guillaume at varnish-software.com>
Date:   Thu Dec 14 17:39:09 2017 +0100

    python3 compatibility
    
    .keys() doesn't produce a list in python3, only an iterable view

diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index c57f96e..851f032 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -801,8 +801,7 @@ class vcc(object):
         fo.write("#endif\n")
         fo.write("\n")
 
-        l = enum_values.keys()
-        l.sort()
+        l = sorted(enum_values)
         for j in l:
             fo.write("extern VCL_ENUM %senum_%s;\n" % (self.sympfx, j))
         fo.write("\n")
@@ -817,8 +816,7 @@ class vcc(object):
         for j in self.contents:
             j.cstruct(fo)
         fo.write("\n")
-        l = enum_values.keys()
-        l.sort()
+        l = sorted(enum_values)
         for j in l:
             fo.write("\tVCL_ENUM\t\t\t*enum_%s;\n" % j)
         fo.write("};\n")
@@ -828,8 +826,7 @@ class vcc(object):
         for j in self.contents:
             j.cstruct_init(fo)
         fo.write("\n")
-        l = enum_values.keys()
-        l.sort()
+        l = sorted(enum_values)
         for j in l:
             fo.write("\t&%senum_%s,\n" % (self.sympfx, j))
         fo.write("};\n")
@@ -887,8 +884,7 @@ class vcc(object):
 
         fo.write("\n")
 
-        l = enum_values.keys()
-        l.sort()
+        l = sorted(enum_values)
         for j in l:
             fo.write('VCL_ENUM %senum_%s = "%s";\n' % (self.sympfx, j, j))
         fo.write("\n")


More information about the varnish-commit mailing list