comparison mercurial/patch.py @ 50587:1c810421a82f

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:33:56 +0100
parents e8c170a6571d
children 886d05ed9a46
comparison
equal deleted inserted replaced
50586:362d5a2ffd17 50587:1c810421a82f
166 inheader = False 166 inheader = False
167 cur = [] 167 cur = []
168 168
169 mimeheaders = [b'content-type'] 169 mimeheaders = [b'content-type']
170 170
171 if not util.safehasattr(stream, b'next'): 171 if not util.safehasattr(stream, 'next'):
172 # http responses, for example, have readline but not next 172 # http responses, for example, have readline but not next
173 stream = fiter(stream) 173 stream = fiter(stream)
174 174
175 for line in stream: 175 for line in stream:
176 cur.append(line) 176 cur.append(line)