From patchwork Wed Mar 2 23:30:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D12290: httppeer: inline simplified _reqdata() From: phabricator X-Patchwork-Id: 50628 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Wed, 2 Mar 2022 23:30:35 +0000 indygreg created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The function can be reduced to an attribute lookup on Python 3. So inline it. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12290 AFFECTED FILES mercurial/httppeer.py CHANGE DETAILS To: indygreg, #hg-reviewers Cc: mercurial-patches, mercurial-devel diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -231,15 +231,6 @@ return req, cu, qs -def _reqdata(req): - """Get request data, if any. If no data, returns None.""" - if pycompat.ispy3: - return req.data - if not req.has_data(): - return None - return req.get_data() - - def sendrequest(ui, opener, req): """Send a prepared HTTP request. @@ -274,7 +265,7 @@ % b' %d bytes of commands arguments in headers' % hgargssize ) - data = _reqdata(req) + data = req.data if data is not None: length = getattr(data, 'length', None) if length is None: