# HG changeset patch # User Gregory Szorc # Date 2015-12-13 07:26:12 # Node ID c2effd1ecebff8c3f154edfed7f1c90ce044283a # Parent b479fc425a81aaadbfbd7d8c36055861db36b826 encoding: use double backslash In Python 2, '\u' == '\\u'. However, in Python 3, '\u' results in: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-1: truncated \uXXXX escape The minor change in this patch allows Python 3 to ast parse encoding.py. diff --git a/mercurial/encoding.py b/mercurial/encoding.py --- a/mercurial/encoding.py +++ b/mercurial/encoding.py @@ -407,7 +407,7 @@ def jsonescape(s): if not _jsonmap: for x in xrange(32): - _jsonmap[chr(x)] = "\u%04x" %x + _jsonmap[chr(x)] = "\\u%04x" % x for x in xrange(32, 256): c = chr(x) _jsonmap[c] = c