##// END OF EJS Templates
py3: stop implicitly importing unicode...
Gregory Szorc -
r43356:bbcbb82e default
parent child Browse files
Show More
@@ -171,8 +171,7 b' if sys.version_info[0] >= 3:'
171 r, c = t.start
171 r, c = t.start
172 l = (
172 l = (
173 b'; from mercurial.pycompat import '
173 b'; from mercurial.pycompat import '
174 b'delattr, getattr, hasattr, setattr, '
174 b'delattr, getattr, hasattr, setattr\n'
175 b'unicode\n'
176 )
175 )
177 for u in tokenize.tokenize(io.BytesIO(l).readline):
176 for u in tokenize.tokenize(io.BytesIO(l).readline):
178 if u.type in (tokenize.ENCODING, token.ENDMARKER):
177 if u.type in (tokenize.ENCODING, token.ENDMARKER):
@@ -221,7 +220,7 b' if sys.version_info[0] >= 3:'
221 # ``replacetoken`` or any mechanism that changes semantics of module
220 # ``replacetoken`` or any mechanism that changes semantics of module
222 # loading is changed. Otherwise cached bytecode may get loaded without
221 # loading is changed. Otherwise cached bytecode may get loaded without
223 # the new transformation mechanisms applied.
222 # the new transformation mechanisms applied.
224 BYTECODEHEADER = b'HG\x00\x0d'
223 BYTECODEHEADER = b'HG\x00\x0e'
225
224
226 class hgloader(importlib.machinery.SourceFileLoader):
225 class hgloader(importlib.machinery.SourceFileLoader):
227 """Custom module loader that transforms source code.
226 """Custom module loader that transforms source code.
@@ -367,7 +367,7 b' def obfuscate(text):'
367 """Any text. Returns the input text rendered as a sequence of
367 """Any text. Returns the input text rendered as a sequence of
368 XML entities.
368 XML entities.
369 """
369 """
370 text = unicode(text, pycompat.sysstr(encoding.encoding), r'replace')
370 text = pycompat.unicode(text, pycompat.sysstr(encoding.encoding), r'replace')
371 return b''.join([b'&#%d;' % ord(c) for c in text])
371 return b''.join([b'&#%d;' % ord(c) for c in text])
372
372
373
373
General Comments 0
You need to be logged in to leave comments. Login now