# HG changeset patch # User Pierre-Yves David # Date 1675354874 -3600 # Node ID 48e69a05675470d74187ddad37d8d4b17a6e470b # Parent ef5435e7604eac70f4f178be0d0b9acd397e1086 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 -r ef5435e7604e -r 48e69a056754 mercurial/commandserver.py --- a/mercurial/commandserver.py Thu Feb 02 17:21:04 2023 +0100 +++ b/mercurial/commandserver.py Thu Feb 02 17:21:14 2023 +0100 @@ -559,7 +559,7 @@ self.ui = ui self.repo = repo self.address = opts[b'address'] - if not util.safehasattr(socket, b'AF_UNIX'): + if not util.safehasattr(socket, 'AF_UNIX'): raise error.Abort(_(b'unsupported platform')) if not self.address: raise error.Abort(_(b'no socket path specified with --address'))