comparison mercurial/httppeer.py @ 50578:35b274cba81d

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:27:58 +0100
parents 315f537627c1
children b23b3ef38ba1
comparison
equal deleted inserted replaced
50577:f30ce3558c2b 50578:35b274cba81d
63 63
64 64
65 class _multifile: 65 class _multifile:
66 def __init__(self, *fileobjs): 66 def __init__(self, *fileobjs):
67 for f in fileobjs: 67 for f in fileobjs:
68 if not util.safehasattr(f, b'length'): 68 if not util.safehasattr(f, 'length'):
69 raise ValueError( 69 raise ValueError(
70 b'_multifile only supports file objects that ' 70 b'_multifile only supports file objects that '
71 b'have a length but this one does not:', 71 b'have a length but this one does not:',
72 type(f), 72 type(f),
73 f, 73 f,