comparison mercurial/commandserver.py @ 50590:48e69a056754

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:21:14 +0100
parents ef5435e7604e
children 9342271eef31
comparison
equal deleted inserted replaced
50589:ef5435e7604e 50590:48e69a056754
557 557
558 def __init__(self, ui, repo, opts, handler=None): 558 def __init__(self, ui, repo, opts, handler=None):
559 self.ui = ui 559 self.ui = ui
560 self.repo = repo 560 self.repo = repo
561 self.address = opts[b'address'] 561 self.address = opts[b'address']
562 if not util.safehasattr(socket, b'AF_UNIX'): 562 if not util.safehasattr(socket, 'AF_UNIX'):
563 raise error.Abort(_(b'unsupported platform')) 563 raise error.Abort(_(b'unsupported platform'))
564 if not self.address: 564 if not self.address:
565 raise error.Abort(_(b'no socket path specified with --address')) 565 raise error.Abort(_(b'no socket path specified with --address'))
566 self._servicehandler = handler or unixservicehandler(ui) 566 self._servicehandler = handler or unixservicehandler(ui)
567 self._sock = None 567 self._sock = None