Mercurial > public > mercurial-scm > hg-stable
diff mercurial/extensions.py @ 34143:82bd4c5a81e5
extensions: fix wrapcommand/function of class instance
5361771f9714 changed _updatewrapper() to copy the __name__ attribute, but
not all callable objects has __name__.
Spotted by loading mq with extdiff.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 10 Sep 2017 23:37:14 +0900 |
parents | a763c891f36e |
children | f7c9c5d8c7f4 |
line wrap: on
line diff
--- a/mercurial/extensions.py Tue Sep 12 09:13:02 2017 -0700 +++ b/mercurial/extensions.py Sun Sep 10 23:37:14 2017 +0900 @@ -333,7 +333,10 @@ def _updatewrapper(wrap, origfn, unboundwrapper): '''Copy and add some useful attributes to wrapper''' - wrap.__name__ = origfn.__name__ + try: + wrap.__name__ = origfn.__name__ + except AttributeError: + pass wrap.__module__ = getattr(origfn, '__module__') wrap.__doc__ = getattr(origfn, '__doc__') wrap.__dict__.update(getattr(origfn, '__dict__', {}))