D472: extensions: make wrapfunction() return a context manager

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Tue Aug 29 09:34:38 EDT 2017


yuja added a comment.


  This is off-topic, but if `wrapfunction()` is a context manager, I think
  `unwrapfunction()` could also be a context manager.

INLINE COMMENTS

> quark wrote in extensions.py:424
> 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`.

My point is why do we care only for `classobj.method = oldfunc`, which seems less likely than `oldfunc()`.

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