safehasattr: pass attribute name as string instead of bytes
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 02 Feb 2023 17:18:37 +0100
changeset 50551 b1fb4185e47c
parent 50550 9e24f8442640
child 50552 037890ecaff5
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/wireprotov1peer.py
--- a/mercurial/wireprotov1peer.py	Thu Feb 02 17:18:24 2023 +0100
+++ b/mercurial/wireprotov1peer.py	Thu Feb 02 17:18:37 2023 +0100
@@ -483,7 +483,7 @@
         else:
             heads = wireprototypes.encodelist(heads)
 
-        if util.safehasattr(bundle, b'deltaheader'):
+        if util.safehasattr(bundle, 'deltaheader'):
             # this a bundle10, do the old style call sequence
             ret, output = self._callpush(b"unbundle", bundle, heads=heads)
             if ret == b"":