# HG changeset patch # User Pierre-Yves David # Date 1675355851 -3600 # Node ID 832df74a488f8d853483b14eff67bdb796ea8d12 # Parent a6a17f7998391358fbdf4621c65a21f43329c95e 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 a6a17f799839 -r 832df74a488f mercurial/templateutil.py --- a/mercurial/templateutil.py Thu Feb 02 17:37:25 2023 +0100 +++ b/mercurial/templateutil.py Thu Feb 02 17:37:31 2023 +0100 @@ -301,7 +301,7 @@ def _wrapvalue(self, key, val): if val is None: return - if util.safehasattr(val, b'_makemap'): + if util.safehasattr(val, '_makemap'): # a nested hybrid list/dict, which has its own way of map operation return val return hybriditem(None, key, val, self._makemap)