Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/utils/stringutil.py @ 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 | 68132a95df31 |
children | 73d0a3dd7e53 |
comparison
equal
deleted
inserted
replaced
37680:e743b8524d60 | 37681:3942bd8db8b2 |
---|---|
508 return _booleans.get(s.lower(), None) | 508 return _booleans.get(s.lower(), None) |
509 | 509 |
510 def evalpythonliteral(s): | 510 def evalpythonliteral(s): |
511 """Evaluate a string containing a Python literal expression""" | 511 """Evaluate a string containing a Python literal expression""" |
512 # We could backport our tokenizer hack to rewrite '' to u'' if we want | 512 # We could backport our tokenizer hack to rewrite '' to u'' if we want |
513 if pycompat.ispy3: | |
514 return ast.literal_eval(s.decode('latin1')) | |
513 return ast.literal_eval(s) | 515 return ast.literal_eval(s) |