ui: construct _keepalnum list in a python3-friendly way
authorAugie Fackler <augie@google.com>
Thu, 16 Feb 2017 11:34:50 -0500
changeset 31034 219629d42786
parent 31033 693a5bb47854
child 31035 1076f7eba964
ui: construct _keepalnum list in a python3-friendly way It'll be more expensive, but it preserves the behavior.
mercurial/ui.py
--- a/mercurial/ui.py	Mon Feb 13 17:03:14 2017 -0800
+++ b/mercurial/ui.py	Thu Feb 16 11:34:50 2017 -0500
@@ -39,7 +39,12 @@
 urlreq = util.urlreq
 
 # for use with str.translate(None, _keepalnum), to keep just alphanumerics
-_keepalnum = ''.join(c for c in map(chr, range(256)) if not c.isalnum())
+if pycompat.ispy3:
+    _bytes = [bytes([c]) for c in range(256)]
+    _notalnum = [s for s in _bytes if not s.isalnum()]
+else:
+    _notalnum = [c for c in map(chr, range(256)) if not c.isalnum()]
+_keepalnum = ''.join(_notalnum)
 
 samplehgrcs = {
     'user':