# HG changeset patch # User Pierre-Yves David # Date 1675355845 -3600 # Node ID a6a17f7998391358fbdf4621c65a21f43329c95e # Parent 90945014f4e46975b53aff5436b0ce1aec15eb21 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. diff -r 90945014f4e4 -r a6a17f799839 mercurial/templateutil.py --- 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))