safehasattr: pass attribute name as string instead of bytes
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 02 Feb 2023 17:34:17 +0100
changeset 50592 0f83dc22efbc
parent 50591 886d05ed9a46
child 50593 5ae124310ab0
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/phases.py
--- a/mercurial/phases.py	Thu Feb 02 17:34:09 2023 +0100
+++ b/mercurial/phases.py	Thu Feb 02 17:34:17 2023 +0100
@@ -463,11 +463,11 @@
     def replace(self, phcache):
         """replace all values in 'self' with content of phcache"""
         for a in (
-            b'phaseroots',
-            b'dirty',
-            b'opener',
-            b'_loadedrevslen',
-            b'_phasesets',
+            'phaseroots',
+            'dirty',
+            'opener',
+            '_loadedrevslen',
+            '_phasesets',
         ):
             setattr(self, a, getattr(phcache, a))