help: fix a py3 error interpolating Set into b'%s' stable
authorMatt Harbison <matt_harbison@yahoo.com>
Sun, 20 Nov 2022 15:55:27 -0500
branchstable
changeset 49590 f09bc2ed9100
parent 49589 3324f39460e5
child 49591 c4874ebe8644
help: fix a py3 error interpolating Set into b'%s' I can't reproduce it, but a coworker hit this with `hg help -v` with 6.2.3: ... File "mercurial\help.pyc", line 865, in helplist TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'set' I can confirm that the original expression fails in `hg debugshell`, and the new one works. The second instance was found by searching for "%s", but PyCharm detects a lot of variables as Any type, so I have no idea if there are other lurking problems.
mercurial/help.py
--- a/mercurial/help.py	Sat Nov 19 16:14:20 2022 +0100
+++ b/mercurial/help.py	Sun Nov 20 15:55:27 2022 -0500
@@ -864,7 +864,7 @@
             if missing_order:
                 ui.develwarn(
                     b'help categories missing from CATEGORY_ORDER: %s'
-                    % missing_order
+                    % stringutil.forcebytestr(missing_order)
                 )
 
             # List per category.
@@ -897,7 +897,7 @@
             if missing_order:
                 ui.develwarn(
                     b'help categories missing from TOPIC_CATEGORY_ORDER: %s'
-                    % missing_order
+                    % stringutil.forcebytestr(missing_order)
                 )
 
             # Output topics per category.