# HG changeset patch # User Pierre-Yves David # Date 2023-02-02 16:35:01 # Node ID 4a60280b56538e939741fd9607e4ecf654d34844 # Parent 9096b00fd8815875e1f1d696d5197a7e06598aff 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/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -516,7 +516,7 @@ def mutableancestors(ctx): def getcommitfunc(extra, interactive, editor=False): def commitfunc(ui, repo, message, match, opts): - hasmq = util.safehasattr(repo, b'mq') + hasmq = util.safehasattr(repo, 'mq') if hasmq: saved, repo.mq.checkapplied = repo.mq.checkapplied, False