##// END OF EJS Templates
py3: stop injecting pycompat.hasattr into modules...
Gregory Szorc -
r43358:0d612db7 default
parent child Browse files
Show More
@@ -171,7 +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\n'
174 b'delattr, getattr\n'
175 )
175 )
176 for u in tokenize.tokenize(io.BytesIO(l).readline):
176 for u in tokenize.tokenize(io.BytesIO(l).readline):
177 if u.type in (tokenize.ENCODING, token.ENDMARKER):
177 if u.type in (tokenize.ENCODING, token.ENDMARKER):
@@ -220,7 +220,7 b' if sys.version_info[0] >= 3:'
220 # ``replacetoken`` or any mechanism that changes semantics of module
220 # ``replacetoken`` or any mechanism that changes semantics of module
221 # loading is changed. Otherwise cached bytecode may get loaded without
221 # loading is changed. Otherwise cached bytecode may get loaded without
222 # the new transformation mechanisms applied.
222 # the new transformation mechanisms applied.
223 BYTECODEHEADER = b'HG\x00\x0f'
223 BYTECODEHEADER = b'HG\x00\x10'
224
224
225 class hgloader(importlib.machinery.SourceFileLoader):
225 class hgloader(importlib.machinery.SourceFileLoader):
226 """Custom module loader that transforms source code.
226 """Custom module loader that transforms source code.
@@ -355,6 +355,7 b' else:'
355 strurl = identity
355 strurl = identity
356 bytesurl = identity
356 bytesurl = identity
357 open = open
357 open = open
358 hasattr = hasattr
358 setattr = setattr
359 setattr = setattr
359
360
360 # this can't be parsed on Python 3
361 # this can't be parsed on Python 3
@@ -168,7 +168,7 b' class ProfileState(object):'
168 # a float
168 # a float
169 if frequency:
169 if frequency:
170 self.sample_interval = 1.0 / frequency
170 self.sample_interval = 1.0 / frequency
171 elif not hasattr(self, 'sample_interval'):
171 elif not pycompat.hasattr(self, 'sample_interval'):
172 # default to 1000 Hz
172 # default to 1000 Hz
173 self.sample_interval = 1.0 / 1000.0
173 self.sample_interval = 1.0 / 1000.0
174 else:
174 else:
General Comments 0
You need to be logged in to leave comments. Login now