comparison tests/test-lock.py @ 34726:daf12f69699f

python3: replace im_{self,func} with __{self,func}__ globally These new names are portable back to Python 2.6. Differential Revision: https://phab.mercurial-scm.org/D1091
author Augie Fackler <augie@google.com>
date Sat, 14 Oct 2017 12:02:15 -0400
parents 68c43a416585
children 5ee3146c1b20
comparison
equal deleted inserted replaced
34725:a288712d86d5 34726:daf12f69699f
17 testlockname = 'testlock' 17 testlockname = 'testlock'
18 18
19 # work around http://bugs.python.org/issue1515 19 # work around http://bugs.python.org/issue1515
20 if types.MethodType not in copy._deepcopy_dispatch: 20 if types.MethodType not in copy._deepcopy_dispatch:
21 def _deepcopy_method(x, memo): 21 def _deepcopy_method(x, memo):
22 return type(x)(x.im_func, copy.deepcopy(x.im_self, memo), x.im_class) 22 return type(x)(x.__func__, copy.deepcopy(x.__self__, memo), x.im_class)
23 copy._deepcopy_dispatch[types.MethodType] = _deepcopy_method 23 copy._deepcopy_dispatch[types.MethodType] = _deepcopy_method
24 24
25 class lockwrapper(lock.lock): 25 class lockwrapper(lock.lock):
26 def __init__(self, pidoffset, *args, **kwargs): 26 def __init__(self, pidoffset, *args, **kwargs):
27 # lock.lock.__init__() calls lock(), so the pidoffset assignment needs 27 # lock.lock.__init__() calls lock(), so the pidoffset assignment needs