##// END OF EJS Templates
extensions: fix wrapcommand/function of class instance...
Yuya Nishihara -
r34130:82bd4c5a default
parent child Browse files
Show More
@@ -333,7 +333,10 def bind(func, *args):
333 333
334 334 def _updatewrapper(wrap, origfn, unboundwrapper):
335 335 '''Copy and add some useful attributes to wrapper'''
336 wrap.__name__ = origfn.__name__
336 try:
337 wrap.__name__ = origfn.__name__
338 except AttributeError:
339 pass
337 340 wrap.__module__ = getattr(origfn, '__module__')
338 341 wrap.__doc__ = getattr(origfn, '__doc__')
339 342 wrap.__dict__.update(getattr(origfn, '__dict__', {}))
@@ -54,3 +54,11 with wrap1:
54 54 print('context manager', dummy.getstack())
55 55 print('context manager', dummy.getstack())
56 56 print('context manager', dummy.getstack())
57
58 # Wrap callable object which has no __name__
59 class callableobj(object):
60 def __call__(self):
61 return ['orig']
62 dummy.cobj = callableobj()
63 extensions.wrapfunction(dummy, 'cobj', wrappers[0])
64 print('wrap callable object', dummy.cobj())
@@ -18,3 +18,4 context manager [0, 1, 'orig']
18 18 context manager [2, 0, 1, 'orig']
19 19 context manager [2, 1, 'orig']
20 20 context manager [2, 'orig']
21 wrap callable object [0, 'orig']
General Comments 0
You need to be logged in to leave comments. Login now