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.
--- a/mercurial/commandserver.py Thu Feb 02 17:20:54 2023 +0100
+++ b/mercurial/commandserver.py Thu Feb 02 17:21:04 2023 +0100
@@ -384,7 +384,7 @@
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)