changeset 37681:3942bd8db8b2

stringutil: ast.literal_eval needs a unicode on py3 Fortunately for us, this is really only used internally, so we can be lazy about the encoding here. test-wireproto-framing.py now passes on Python 3. Differential Revision: https://phab.mercurial-scm.org/D3368
author Augie Fackler <augie@google.com>
date Sat, 14 Apr 2018 01:34:44 -0400
parents e743b8524d60
children cb71e0f9ac6f
files contrib/python3-whitelist mercurial/utils/stringutil.py
diffstat 2 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/python3-whitelist	Fri Apr 13 22:55:01 2018 -0700
+++ b/contrib/python3-whitelist	Sat Apr 14 01:34:44 2018 -0400
@@ -437,4 +437,5 @@
 test-verify.t
 test-websub.t
 test-win32text.t
+test-wireproto-framing.py
 test-xdg.t
--- a/mercurial/utils/stringutil.py	Fri Apr 13 22:55:01 2018 -0700
+++ b/mercurial/utils/stringutil.py	Sat Apr 14 01:34:44 2018 -0400
@@ -510,4 +510,6 @@
 def evalpythonliteral(s):
     """Evaluate a string containing a Python literal expression"""
     # We could backport our tokenizer hack to rewrite '' to u'' if we want
+    if pycompat.ispy3:
+        return ast.literal_eval(s.decode('latin1'))
     return ast.literal_eval(s)