changeset 48887:426cf9d98a5d

httppeer: inline simplified _reqdata() The function can be reduced to an attribute lookup on Python 3. So inline it. Differential Revision: https://phab.mercurial-scm.org/D12290
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 21 Feb 2022 10:25:53 -0700
parents 127cc4535853
children 07a7b57d3e33
files mercurial/httppeer.py
diffstat 1 files changed, 1 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/httppeer.py	Mon Feb 21 10:23:54 2022 -0700
+++ b/mercurial/httppeer.py	Mon Feb 21 10:25:53 2022 -0700
@@ -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: