# HG changeset patch # User Pierre-Yves David # Date 2023-02-02 16:36:55 # Node ID bf7ad17b0a587e4953a5ad4ac7b857d690ed6817 # Parent a30e6401c7f08529220cc6f1fcccf6a37b852bde 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/subrepoutil.py b/mercurial/subrepoutil.py --- a/mercurial/subrepoutil.py +++ b/mercurial/subrepoutil.py @@ -428,7 +428,7 @@ def _abssource(repo, push=False, abort=T return bytes(parent) else: # recursion reached top repo path = None - if util.safehasattr(repo, b'_subtoppath'): + if util.safehasattr(repo, '_subtoppath'): path = repo._subtoppath elif push and repo.ui.config(b'paths', b'default-push'): path = repo.ui.config(b'paths', b'default-push')