Mercurial > hg
changeset 50610:a6a17f799839
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.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 02 Feb 2023 17:37:25 +0100 |
parents | 90945014f4e4 |
children | 832df74a488f |
files | mercurial/templateutil.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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))