comparison mercurial/extensions.py @ 51137:eda075d7b2ac

cleanup: turn `wrapfunction` deprecation warning into an error We could simply drop the check, but lets raise explicit error instead of suffering strange error in case of misuse.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 08 Nov 2023 22:20:58 +0100
parents 7b837fabc990
children 493034cc3265
comparison
equal deleted inserted replaced
51136:7b837fabc990 51137:eda075d7b2ac
672 subclass trick. 672 subclass trick.
673 """ 673 """
674 assert callable(wrapper) 674 assert callable(wrapper)
675 675
676 if not isinstance(funcname, str): 676 if not isinstance(funcname, str):
677 msg = b"pass wrapfunction target name as `str`, not `bytes`" 677 msg = b"wrapfunction target name should be `str`, not `bytes`"
678 util.nouideprecwarn(msg, b"6.6", stacklevel=2) 678 raise TypeError(msg)
679 funcname = pycompat.sysstr(funcname)
680 679
681 origfn = getattr(container, funcname) 680 origfn = getattr(container, funcname)
682 assert callable(origfn) 681 assert callable(origfn)
683 if inspect.ismodule(container): 682 if inspect.ismodule(container):
684 # origfn is not an instance or class method. "partial" can be used. 683 # origfn is not an instance or class method. "partial" can be used.