Hello,
On 2023/12/07 17:51, Ruediger Pluem wrote:
I stumbled accross a Python 3 compatibility issue in
tools/hook-scripts/mailer/mailer.py.
The call of self.cfg.which_groups in line 565 passes an empty string as first
parameter.
In which_groups this empty string is passed to to_str in line 1489.
In line 88 to_str does x.decode('utf-8')
In Python 2 str objects have a decode method at least in later Python 3
versions they have not. Hence I propose the following patch which fixes the
issue for me:
Thank you for the report and proposing a patch.
This was caused by my overlook.
I've checked the usage of Config.which_groups(), then it turned out
that only the call from Commits.__init__ passes a path as a bytes,
and calls from Look.__init__ and PropChange.__init__ pass a path
as str. More over, in Config.which_groups(), the path argment is
always converted to str when it is used.
So I prefer changing Config.which_groups to accept str path, and
also changing Commits.__init__ to pass a str path.
Index: mailer.py
===================================================================
--- mailer.py (revision 1914422)
+++ mailer.py (working copy)
@@ -562,7 +562,7 @@
# collect the set of groups and the unique sets of params for the options
self.groups = { }
- for (group, params) in self.cfg.which_groups('', None):
+ for (group, params) in self.cfg.which_groups(b'', None):
# turn the params into a hashable object and stash it away
param_list = sorted(params.items())
self.groups[group, tuple(param_list)] = params
If I would get a go ahead here on list I would commit.
Regards
RĂ¼diger
Thanks,
--
Yasuhito FUTATSUKI <futat...@yf.bsdclub.org>