changeset 50800:94506fc107b7

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`.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 10 Jul 2023 15:39:19 +0200
parents 02eae2df911a
children ee1617c04858
files mercurial/extensions.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/extensions.py	Mon Jul 10 19:34:04 2023 +0200
+++ b/mercurial/extensions.py	Mon Jul 10 15:39:19 2023 +0200
@@ -626,6 +626,10 @@
 
     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