# HG changeset patch # User Pierre-Yves David # Date 2023-02-02 16:22:55 # Node ID 8020be6a9d282b2770e0dd8684628305daf73c7e # Parent 87b004378fc49be1e1681accf1edc48fff4f87ff 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/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -1278,7 +1278,7 @@ def debugdiscovery(ui, repo, remoteurl=b if opts.get(b'old'): def doit(pushedrevs, remoteheads, remote=remote): - if not util.safehasattr(remote, b'branches'): + if not util.safehasattr(remote, 'branches'): # enable in-client legacy support remote = localrepo.locallegacypeer(remote.local()) if remote_revs: