pycompat: deprecate using bytes
Python2 has been dropped for a while, so lets comply to the signature of the
global function.
This open the way to drop the use of `pycompat.getattr` and company, and,
especially, the associated `util.safehasattr`.
--- a/mercurial/pycompat.py Thu Aug 31 02:41:33 2023 +0200
+++ b/mercurial/pycompat.py Thu Dec 08 15:57:42 2022 +0100
@@ -355,6 +355,13 @@
def _wrapattrfunc(f):
@functools.wraps(f)
def w(object, name, *args):
+ if isinstance(name, bytes):
+ from . import util
+
+ msg = b'function "%s" take `str` as argument, not `bytes`'
+ fname = f.__name__.encode('ascii')
+ msg %= fname
+ util.nouideprecwarn(msg, b"6.6", stacklevel=2)
return f(object, sysstr(name), *args)
return w