comparison mercurial/dispatch.py @ 50603:35e420abaef3

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:24:05 +0100
parents dbd57239acb8
children 9a322ccd2fdc
comparison
equal deleted inserted replaced
50602:dbd57239acb8 50603:35e420abaef3
732 b'commandalias', 732 b'commandalias',
733 b"alias '%s' expands to '%s'\n", 733 b"alias '%s' expands to '%s'\n",
734 self.name, 734 self.name,
735 self.definition, 735 self.definition,
736 ) 736 )
737 if util.safehasattr(self, b'shell'): 737 if util.safehasattr(self, 'shell'):
738 return self.fn(ui, *args, **opts) 738 return self.fn(ui, *args, **opts)
739 else: 739 else:
740 try: 740 try:
741 return util.checksignature(self.fn)(ui, *args, **opts) 741 return util.checksignature(self.fn)(ui, *args, **opts)
742 except error.SignatureError: 742 except error.SignatureError: