[PATCH py3] regex: make the regular expression bytes to prevent TypeError
Pulkit Goyal
7895pulkit at gmail.com
Sun Mar 19 08:25:49 UTC 2017
# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1489707658 -19800
# Fri Mar 17 05:10:58 2017 +0530
# Node ID 0b63c5f5bb298086e4d847941943b007ce7bec63
# Parent e0e1c056226ea2cac3e3a312b1455d37d8ae8d6c
regex: make the regular expression bytes to prevent TypeError
diff -r e0e1c056226e -r 0b63c5f5bb29 mercurial/dispatch.py
--- a/mercurial/dispatch.py Thu Mar 16 10:11:21 2017 +0530
+++ b/mercurial/dispatch.py Fri Mar 17 05:10:58 2017 +0530
@@ -286,7 +286,7 @@
if num < len(givenargs):
return givenargs[num]
raise error.Abort(_('too few arguments for command alias'))
- cmd = re.sub(r'\$(\d+|\$)', replacer, cmd)
+ cmd = re.sub(br'\$(\d+|\$)', replacer, cmd)
givenargs = [x for i, x in enumerate(givenargs)
if i not in nums]
args = pycompat.shlexsplit(cmd)
diff -r e0e1c056226e -r 0b63c5f5bb29 mercurial/posix.py
--- a/mercurial/posix.py Thu Mar 16 10:11:21 2017 +0530
+++ b/mercurial/posix.py Fri Mar 17 05:10:58 2017 +0530
@@ -408,7 +408,7 @@
return '"%s"' % s
global _needsshellquote
if _needsshellquote is None:
- _needsshellquote = re.compile(r'[^a-zA-Z0-9._/+-]').search
+ _needsshellquote = re.compile(br'[^a-zA-Z0-9._/+-]').search
if s and not _needsshellquote(s):
# "s" shouldn't have to be quoted
return s
More information about the Mercurial-devel
mailing list