py3: byteify contrib/check-config.py
authorMatt Harbison <matt_harbison@yahoo.com>
Tue, 18 Sep 2018 23:56:38 -0400
changeset 39708 fe28267d5223
parent 39707 5abc47d4ca6b
child 39709 254361f727bd
py3: byteify contrib/check-config.py The corresponding *.t still fails because of bytes (with a 'b' prefix) vs str printing, but no longer crashes. # skip-blame for b'' prefixing
contrib/check-config.py
--- a/contrib/check-config.py	Tue Sep 18 23:47:21 2018 -0400
+++ b/contrib/check-config.py	Tue Sep 18 23:56:38 2018 -0400
@@ -104,12 +104,12 @@
                 ctype = m.group('ctype')
                 if not ctype:
                     ctype = 'str'
-                name = m.group('section') + "." + m.group('option')
+                name = m.group('section') + b"." + m.group('option')
                 default = m.group('default')
                 if default in (None, 'False', 'None', '0', '[]', '""', "''"):
-                    default = ''
+                    default = b''
                 if re.match(b'[a-z.]+$', default):
-                    default = '<variable>'
+                    default = b'<variable>'
                 if (name in foundopts and (ctype, default) != foundopts[name]
                     and name not in allowinconsistent):
                     print(l.rstrip())
@@ -117,19 +117,19 @@
                                                         foundopts[name]))
                     print("at %s:%d:" % (f, linenum))
                 foundopts[name] = (ctype, default)
-                carryover = ''
+                carryover = b''
             else:
                 m = re.search(configpartialre, line)
                 if m:
                     carryover = line
                 else:
-                    carryover = ''
+                    carryover = b''
 
     for name in sorted(foundopts):
         if name not in documented:
-            if not (name.startswith("devel.") or
-                    name.startswith("experimental.") or
-                    name.startswith("debug.")):
+            if not (name.startswith(b"devel.") or
+                    name.startswith(b"experimental.") or
+                    name.startswith(b"debug.")):
                 ctype, default = foundopts[name]
                 if default:
                     default = ' [%s]' % default