# HG changeset patch # User Pierre-Yves David # Date 1675355636 -3600 # Node ID 1c810421a82f1ba708c88e194af03916e3009787 # Parent 362d5a2ffd1739248d7140212f641d49264c1340 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 362d5a2ffd17 -r 1c810421a82f mercurial/patch.py --- a/mercurial/patch.py Thu Feb 02 17:32:38 2023 +0100 +++ b/mercurial/patch.py Thu Feb 02 17:33:56 2023 +0100 @@ -168,7 +168,7 @@ mimeheaders = [b'content-type'] - if not util.safehasattr(stream, b'next'): + if not util.safehasattr(stream, 'next'): # http responses, for example, have readline but not next stream = fiter(stream)