Details
Details
- Reviewers
yuja - Group Reviewers
hg-reviewers - Commits
- rHG0646608368a9: extensions: don't give AttributeError bytes message on Python 3
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
yuja |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/extensions.py (4 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Abandoned | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 |
origfn = currcls.__dict__[propname].func | origfn = currcls.__dict__[propname].func | ||||
assert callable(origfn) | assert callable(origfn) | ||||
def wrap(*args, **kwargs): | def wrap(*args, **kwargs): | ||||
return wrapper(origfn, *args, **kwargs) | return wrapper(origfn, *args, **kwargs) | ||||
currcls.__dict__[propname].func = wrap | currcls.__dict__[propname].func = wrap | ||||
break | break | ||||
if currcls is object: | if currcls is object: | ||||
raise AttributeError( | raise AttributeError(r"type '%s' has no property '%s'" % ( | ||||
_("type '%s' has no property '%s'") % (cls, propname)) | cls, propname)) | ||||
def wrapfunction(container, funcname, wrapper): | def wrapfunction(container, funcname, wrapper): | ||||
'''Wrap the function named funcname in container | '''Wrap the function named funcname in container | ||||
Replace the funcname member in the given container with the specified | Replace the funcname member in the given container with the specified | ||||
wrapper. The container is typically a module, class, or instance. | wrapper. The container is typically a module, class, or instance. | ||||
The wrapper will be called like | The wrapper will be called like |