changeset 50575:029fe2f012c8

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 02 Feb 2023 17:26:32 +0100
parents c04abc7340f1
children 3b642b384b14
files mercurial/hg.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Thu Feb 02 17:26:23 2023 +0100
+++ b/mercurial/hg.py	Thu Feb 02 17:26:32 2023 +0100
@@ -1567,7 +1567,7 @@
 
 def remoteui(src, opts):
     """build a remote ui from ui or repo and opts"""
-    if util.safehasattr(src, b'baseui'):  # looks like a repository
+    if util.safehasattr(src, 'baseui'):  # looks like a repository
         dst = src.baseui.copy()  # drop repo-specific config
         src = src.ui  # copy target options from repo
     else:  # assume it's a global ui object