# HG changeset patch # User Pierre-Yves David # Date 2023-02-02 16:34:17 # Node ID 0f83dc22efbc5505da41c6c2065f8d84af1f1708 # Parent 886d05ed9a46817c16700ee648e843244e3db129 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 --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -463,11 +463,11 @@ class phasecache: 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))