# HG changeset patch # User Pierre-Yves David # Date 2023-07-10 13:39:19 # Node ID 94506fc107b7457b5ad3c37c03e0e978b52f2881 # Parent 02eae2df911a14a87c1cb002e7d7f1c8666f3ce7 wrapfunction: deprecates calling `wrappedfunction` with bytes This will help us to detect and eradicates legacy calls. This is on the path to deprecating `util.safehasattr`. diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -626,6 +626,10 @@ class wrappedfunction: def __init__(self, container, funcname, wrapper): assert callable(wrapper) + if not isinstance(funcname, str): + 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