diff -r b019b5798e8f -r 8317993a49f1 mercurial/extensions.py --- a/mercurial/extensions.py Wed Jan 29 14:48:50 2025 +0000 +++ b/mercurial/extensions.py Fri Feb 07 19:14:05 2025 -0500 @@ -623,11 +623,13 @@ class wrappedfunction: '''context manager for temporarily wrapping a function''' - def __init__(self, container, funcname, wrapper): + def __init__(self, container, funcname: str, wrapper): assert callable(wrapper) if not isinstance(funcname, str): - msg = b"wrappedfunction target name should be `str`, not `bytes`" - raise TypeError(msg) + # Keep this compat shim around for older/unmaintained extensions + msg = b"pass wrappedfunction target name as `str`, not `bytes`" + util.nouideprecwarn(msg, b"6.6", stacklevel=2) + funcname = pycompat.sysstr(funcname) self._container = container self._funcname = funcname self._wrapper = wrapper @@ -639,7 +641,7 @@ unwrapfunction(self._container, self._funcname, self._wrapper) -def wrapfunction(container, funcname, wrapper): +def wrapfunction(container, funcname: str, wrapper): """Wrap the function named funcname in container Replace the funcname member in the given container with the specified @@ -675,8 +677,10 @@ assert callable(wrapper) if not isinstance(funcname, str): - msg = b"wrapfunction target name should be `str`, not `bytes`" - raise TypeError(msg) + # Keep this compat shim around for older/unmaintained extensions + msg = b"pass wrapfunction target name as `str`, not `bytes`" + util.nouideprecwarn(msg, b"6.6", stacklevel=2) + funcname = pycompat.sysstr(funcname) origfn = getattr(container, funcname) assert callable(origfn)