changeset 30349:954002426f78

config: mark parser regexes as bytes explicitly r-strings are not transformed into bytes by our source transformer magic.
author Augie Fackler <augie@google.com>
date Sun, 09 Oct 2016 09:25:39 -0400
parents 9df29b7c62cf
children 358cda0af6ee
files mercurial/config.py tests/test-check-py3-commands.t
diffstat 2 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/config.py	Sun Oct 09 09:17:49 2016 -0400
+++ b/mercurial/config.py	Sun Oct 09 09:25:39 2016 -0400
@@ -90,13 +90,13 @@
             self._source.pop((section, item), None)
 
     def parse(self, src, data, sections=None, remap=None, include=None):
-        sectionre = util.re.compile(r'\[([^\[]+)\]')
-        itemre = util.re.compile(r'([^=\s][^=]*?)\s*=\s*(.*\S|)')
-        contre = util.re.compile(r'\s+(\S|\S.*\S)\s*$')
-        emptyre = util.re.compile(r'(;|#|\s*$)')
-        commentre = util.re.compile(r'(;|#)')
-        unsetre = util.re.compile(r'%unset\s+(\S+)')
-        includere = util.re.compile(r'%include\s+(\S|\S.*\S)\s*$')
+        sectionre = util.re.compile(br'\[([^\[]+)\]')
+        itemre = util.re.compile(br'([^=\s][^=]*?)\s*=\s*(.*\S|)')
+        contre = util.re.compile(br'\s+(\S|\S.*\S)\s*$')
+        emptyre = util.re.compile(br'(;|#|\s*$)')
+        commentre = util.re.compile(br'(;|#)')
+        unsetre = util.re.compile(br'%unset\s+(\S+)')
+        includere = util.re.compile(br'%include\s+(\S|\S.*\S)\s*$')
         section = ""
         item = None
         line = 0
--- a/tests/test-check-py3-commands.t	Sun Oct 09 09:17:49 2016 -0400
+++ b/tests/test-check-py3-commands.t	Sun Oct 09 09:25:39 2016 -0400
@@ -9,6 +9,6 @@
   >   $PYTHON3 `which hg` $cmd 2>&1 2>&1 | tail -1
   > done
   version
-  TypeError: cannot use a string pattern on a bytes-like object
+  NameError: name 'basestring' is not defined
   debuginstall
-  TypeError: cannot use a string pattern on a bytes-like object
+  NameError: name 'basestring' is not defined