D472: extensions: make wrapfunction() return a context manager
quark (Jun Wu)
phabricator at mercurial-scm.org
Mon Aug 28 17:02:13 UTC 2017
quark added inline comments.
INLINE COMMENTS
> yuja wrote in extensions.py:424
> I see, but I don't think it's more common than wrapping a plain
> function.
>
> If the compatibility matters, we probably shouldn't replace
> `wrapfunction` with a context manager.
I think using the return value of wrapfunction could lead to hidden bugs:
oldfunc = wrapfunction(x, 'y', newfunc)
...
# what if somebody else wraps x.y here?
...
x.y = oldfunc
So it seems reasonable to me to deprecate that and migrate users to `unwrapfunction`.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D472
To: martinvonz, #hg-reviewers, quark, mjpieters
Cc: yuja, lothiraldan, quark, mjpieters, mercurial-devel
More information about the Mercurial-devel
mailing list