comparison mercurial/extensions.py @ 51136:7b837fabc990

cleanup: turn `wrappedfunction` 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:19:20 +0100
parents 18c8c18993f0
children eda075d7b2ac
comparison
equal deleted inserted replaced
51135:5c9c41273367 51136:7b837fabc990
623 '''context manager for temporarily wrapping a function''' 623 '''context manager for temporarily wrapping a function'''
624 624
625 def __init__(self, container, funcname, wrapper): 625 def __init__(self, container, funcname, wrapper):
626 assert callable(wrapper) 626 assert callable(wrapper)
627 if not isinstance(funcname, str): 627 if not isinstance(funcname, str):
628 msg = b"pass wrappedfunction target name as `str`, not `bytes`" 628 msg = b"wrappedfunction target name should be `str`, not `bytes`"
629 util.nouideprecwarn(msg, b"6.6", stacklevel=2) 629 raise TypeError(msg)
630 funcname = pycompat.sysstr(funcname)
631 self._container = container 630 self._container = container
632 self._funcname = funcname 631 self._funcname = funcname
633 self._wrapper = wrapper 632 self._wrapper = wrapper
634 633
635 def __enter__(self): 634 def __enter__(self):