comparison mercurial/extensions.py @ 50801:ee1617c04858

wrapfunction: deprecated calling "wrapfunction" with bytes This will help us to detect and eradicates legacy calls. This is on the path to deprecating `util.safehasattr`.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 10 Jul 2023 10:53:12 +0200
parents 94506fc107b7
children 3ccef7902070
comparison
equal deleted inserted replaced
50800:94506fc107b7 50801:ee1617c04858
674 your end users, you should play nicely with others by using the 674 your end users, you should play nicely with others by using the
675 subclass trick. 675 subclass trick.
676 """ 676 """
677 assert callable(wrapper) 677 assert callable(wrapper)
678 678
679 if not isinstance(funcname, str):
680 msg = b"pass wrapfunction target name as `str`, not `bytes`"
681 util.nouideprecwarn(msg, b"6.6", stacklevel=2)
682 funcname = pycompat.sysstr(funcname)
683
679 origfn = getattr(container, funcname) 684 origfn = getattr(container, funcname)
680 assert callable(origfn) 685 assert callable(origfn)
681 if inspect.ismodule(container): 686 if inspect.ismodule(container):
682 # origfn is not an instance or class method. "partial" can be used. 687 # origfn is not an instance or class method. "partial" can be used.
683 # "partial" won't insert a frame in traceback. 688 # "partial" won't insert a frame in traceback.