Mercurial > hg
comparison mercurial/help.py @ 50621:822320591c46
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:26:10 +0100 |
parents | f56873a7284c |
children | d718eddf01d9 |
comparison
equal
deleted
inserted
replaced
50620:26e63204c31e | 50621:822320591c46 |
---|---|
808 | 808 |
809 # description | 809 # description |
810 doc = gettext(pycompat.getdoc(entry[0])) | 810 doc = gettext(pycompat.getdoc(entry[0])) |
811 if not doc: | 811 if not doc: |
812 doc = _(b"(no help text available)") | 812 doc = _(b"(no help text available)") |
813 if util.safehasattr(entry[0], b'definition'): # aliased command | 813 if util.safehasattr(entry[0], 'definition'): # aliased command |
814 source = entry[0].source | 814 source = entry[0].source |
815 if entry[0].definition.startswith(b'!'): # shell alias | 815 if entry[0].definition.startswith(b'!'): # shell alias |
816 doc = _(b'shell alias for: %s\n\n%s\n\ndefined by: %s\n') % ( | 816 doc = _(b'shell alias for: %s\n\n%s\n\ndefined by: %s\n') % ( |
817 entry[0].definition[1:], | 817 entry[0].definition[1:], |
818 doc, | 818 doc, |