changeset 50909:35885dbdc927

path-suboption: deprecated specifying the attributes as bytes The known suboptions have been updated, so we can deprecated passing bytes in case some extensions use them.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 30 Aug 2023 00:50:28 +0200
parents ceac1bd816f7
children 1270677d740b
files mercurial/utils/urlutil.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/utils/urlutil.py	Wed Aug 30 00:49:52 2023 +0200
+++ b/mercurial/utils/urlutil.py	Wed Aug 30 00:50:28 2023 +0200
@@ -18,6 +18,7 @@
     error,
     pycompat,
     urllibcompat,
+    util,
 )
 
 from . import (
@@ -681,6 +682,10 @@
     This decorator can be used to perform additional verification of
     sub-options and to change the type of sub-options.
     """
+    if isinstance(attr, bytes):
+        msg = b'pathsuboption take `str` as "attr" argument, not `bytes`'
+        util.nouideprecwarn(msg, b"6.6", stacklevel=2)
+        attr = attr.decode('ascii')
 
     def register(func):
         _pathsuboptions[option] = (attr, func)