safehasattr: pass attribute name as string instead of bytes
This is a step toward replacing `util.safehasattr` usage with plain `hasattr`.
The builtin function behave poorly in Python2 but this was fixed in Python3.
These change are done one by one as they tend to have a small odd to trigger
puzzling breackage.
--- a/mercurial/templateutil.py Thu Feb 02 17:37:11 2023 +0100
+++ b/mercurial/templateutil.py Thu Feb 02 17:37:25 2023 +0100
@@ -281,7 +281,7 @@
def getmember(self, context, mapping, key):
# TODO: maybe split hybrid list/dict types?
- if not util.safehasattr(self._values, b'get'):
+ if not util.safehasattr(self._values, 'get'):
raise error.ParseError(_(b'not a dictionary'))
key = unwrapastype(context, mapping, key, self._keytype)
return self._wrapvalue(key, self._values.get(key))