##// END OF EJS Templates
py3: add pycompat.unicode and add it to importer...
Pulkit Goyal -
r31843:526e4597 default
parent child Browse files
Show More
@@ -283,7 +283,8 b' if sys.version_info[0] >= 3:'
283 283 continue
284 284 r, c = t.start
285 285 l = (b'; from mercurial.pycompat import '
286 b'delattr, getattr, hasattr, setattr, xrange, open\n')
286 b'delattr, getattr, hasattr, setattr, xrange, '
287 b'open, unicode\n')
287 288 for u in tokenize.tokenize(io.BytesIO(l).readline):
288 289 if u.type in (tokenize.ENCODING, token.ENDMARKER):
289 290 continue
@@ -323,7 +324,7 b' if sys.version_info[0] >= 3:'
323 324 # ``replacetoken`` or any mechanism that changes semantics of module
324 325 # loading is changed. Otherwise cached bytecode may get loaded without
325 326 # the new transformation mechanisms applied.
326 BYTECODEHEADER = b'HG\x00\x09'
327 BYTECODEHEADER = b'HG\x00\x0a'
327 328
328 329 class hgloader(importlib.machinery.SourceFileLoader):
329 330 """Custom module loader that transforms source code.
@@ -174,6 +174,7 b' if ispy3:'
174 174 hasattr = _wrapattrfunc(builtins.hasattr)
175 175 setattr = _wrapattrfunc(builtins.setattr)
176 176 xrange = builtins.range
177 unicode = str
177 178
178 179 def open(name, mode='r', buffering=-1):
179 180 return builtins.open(name, sysstr(mode), buffering)
General Comments 0
You need to be logged in to leave comments. Login now