changeset 41835:ddb174511f1b

revsetlang: use sysbytes() instead of blind encode() Otherwise we will call str.encode() on Python 2, which is wrong. sysbytes() does encode('utf-8') on Python 3. But the source is guaranteed ASCII, so it shouldn't matter. With this change, `hg` now runs with `HGUNICODEPEDANTRY=1` set. However, several tests are failing. Differential Revision: https://phab.mercurial-scm.org/D6050
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 02 Mar 2019 13:02:39 -0800
parents 7f63ec6969f3
children 25694a78e4a4
files mercurial/revsetlang.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revsetlang.py	Sat Mar 02 12:57:00 2019 -0800
+++ b/mercurial/revsetlang.py	Sat Mar 02 13:02:39 2019 -0800
@@ -62,8 +62,8 @@
 
 # default set of valid characters for the initial letter of symbols
 _syminitletters = set(pycompat.iterbytestr(
-    string.ascii_letters.encode('ascii') +
-    string.digits.encode('ascii') +
+    pycompat.sysbytes(string.ascii_letters) +
+    pycompat.sysbytes(string.digits) +
     '._@')) | set(map(pycompat.bytechr, pycompat.xrange(128, 256)))
 
 # default set of valid characters for non-initial letters of symbols