# HG changeset patch # User Pierre-Yves David # Date 2023-02-02 16:21:04 # Node ID ef5435e7604eac70f4f178be0d0b9acd397e1086 # Parent 6e749d4abf0513f81ff2add941e154b4df3fc26c 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/commandserver.py b/mercurial/commandserver.py --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -384,7 +384,7 @@ class server: if self.cmsg: hellomsg += b'message-encoding: %s\n' % self.cmsg.encoding hellomsg += b'pid: %d' % procutil.getpid() - if util.safehasattr(os, b'getpgid'): + if util.safehasattr(os, 'getpgid'): hellomsg += b'\n' hellomsg += b'pgid: %d' % os.getpgid(0)