wrapfunction: deprecated calling "wrapfunction" with bytes
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 10 Jul 2023 10:53:12 +0200
changeset 50838 ee1617c04858
parent 50837 94506fc107b7
child 50839 cf0502231d56
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`.
mercurial/extensions.py
--- a/mercurial/extensions.py	Mon Jul 10 15:39:19 2023 +0200
+++ b/mercurial/extensions.py	Mon Jul 10 10:53:12 2023 +0200
@@ -676,6 +676,11 @@
     """
     assert callable(wrapper)
 
+    if not isinstance(funcname, str):
+        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)
     if inspect.ismodule(container):