safehasattr: pass attribute name as string instead of bytes
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 02 Feb 2023 17:34:33 +0100
changeset 50594 8b605d19cb6f
parent 50593 5ae124310ab0
child 50595 9096b00fd881
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.
mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py	Thu Feb 02 17:34:25 2023 +0100
+++ b/mercurial/revlogutils/deltas.py	Thu Feb 02 17:34:33 2023 +0100
@@ -1067,7 +1067,7 @@
             end_rev < self._start_rev or end_rev > self._end_rev
         ), (self._start_rev, self._end_rev, start_rev, end_rev)
         cache = self.snapshots
-        if util.safehasattr(revlog.index, b'findsnapshots'):
+        if util.safehasattr(revlog.index, 'findsnapshots'):
             revlog.index.findsnapshots(cache, start_rev, end_rev)
         else:
             deltaparent = revlog.deltaparent