comparison mercurial/templateutil.py @ 50611:832df74a488f

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:31 +0100
parents a6a17f799839
children f013e790d8bf
comparison
equal deleted inserted replaced
50610:a6a17f799839 50611:832df74a488f
299 return self._wrapvalue(val, val) 299 return self._wrapvalue(val, val)
300 300
301 def _wrapvalue(self, key, val): 301 def _wrapvalue(self, key, val):
302 if val is None: 302 if val is None:
303 return 303 return
304 if util.safehasattr(val, b'_makemap'): 304 if util.safehasattr(val, '_makemap'):
305 # a nested hybrid list/dict, which has its own way of map operation 305 # a nested hybrid list/dict, which has its own way of map operation
306 return val 306 return val
307 return hybriditem(None, key, val, self._makemap) 307 return hybriditem(None, key, val, self._makemap)
308 308
309 def filter(self, context, mapping, select): 309 def filter(self, context, mapping, select):