Mercurial > public > mercurial-scm > hg-stable
diff mercurial/httppeer.py @ 50951:d718eddf01d9
safehasattr: drop usage in favor of hasattr
The two functions should now be equivalent at least in their usage in core.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 31 Aug 2023 23:56:15 +0200 |
parents | 60f9602b413e |
children | 18c8c18993f0 |
line wrap: on
line diff
--- a/mercurial/httppeer.py Thu Dec 08 15:33:19 2022 +0100 +++ b/mercurial/httppeer.py Thu Aug 31 23:56:15 2023 +0200 @@ -65,7 +65,7 @@ class _multifile: def __init__(self, *fileobjs): for f in fileobjs: - if not util.safehasattr(f, 'length'): + if not hasattr(f, 'length'): raise ValueError( b'_multifile only supports file objects that ' b'have a length but this one does not:', @@ -180,7 +180,7 @@ qs = b'?%s' % urlreq.urlencode(q) cu = b"%s%s" % (repobaseurl, qs) size = 0 - if util.safehasattr(data, 'length'): + if hasattr(data, 'length'): size = data.length elif data is not None: size = len(data)