D3368: stringutil: ast.literal_eval needs a unicode on py3
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Sat Apr 14 05:37:37 UTC 2018
durin42 created this revision.
Herald added a reviewer: pulkit.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3368
AFFECTED FILES
contrib/python3-whitelist
mercurial/utils/stringutil.py
CHANGE DETAILS
diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py
--- a/mercurial/utils/stringutil.py
+++ b/mercurial/utils/stringutil.py
@@ -516,4 +516,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)
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -444,4 +444,5 @@
test-verify.t
test-websub.t
test-win32text.t
+test-wireproto-framing.py
test-xdg.t
To: durin42, pulkit, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list