Patchwork D12290: httppeer: inline simplified _reqdata()

login
register
mail settings
Submitter phabricator
Date March 2, 2022, 11:30 p.m.
Message ID <differential-rev-PHID-DREV-or4e2t7qkgqdhzjktpld-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50628/
State New
Headers show

Comments

phabricator - March 2, 2022, 11:30 p.m.
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

Patch

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: