changeset 31014:219629d42786

ui: construct _keepalnum list in a python3-friendly way It'll be more expensive, but it preserves the behavior.
author Augie Fackler <augie@google.com>
date Thu, 16 Feb 2017 11:34:50 -0500
parents 693a5bb47854
children 1076f7eba964
files mercurial/ui.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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':