comparison mercurial/utils/stringutil.py @ 48911:46b3ecfb16e2

stringutil: remove Python 2 support code Differential Revision: https://phab.mercurial-scm.org/D12314
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 21 Feb 2022 10:53:09 -0700
parents 6000f5b25c9b
children 642e31cb55f0
comparison
equal deleted inserted replaced
48910:3681b4c56618 48911:46b3ecfb16e2
962 962
963 963
964 def evalpythonliteral(s): 964 def evalpythonliteral(s):
965 """Evaluate a string containing a Python literal expression""" 965 """Evaluate a string containing a Python literal expression"""
966 # We could backport our tokenizer hack to rewrite '' to u'' if we want 966 # We could backport our tokenizer hack to rewrite '' to u'' if we want
967 if pycompat.ispy3: 967 return ast.literal_eval(s.decode('latin1'))
968 return ast.literal_eval(s.decode('latin1'))
969 return ast.literal_eval(s)