Patchwork [09,of,10] py3: replace use of Request.has_data() with pycompat.request_has_data(request)

login
register
mail settings
Submitter Pulkit Goyal
Date May 6, 2017, 3:01 a.m.
Message ID <ab836b82e94bac18f61b.1494039681@pulkit-goyal>
Download mbox | patch
Permalink /patch/20477/
State Accepted
Headers show

Comments

Pulkit Goyal - May 6, 2017, 3:01 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1494037687 -19800
#      Sat May 06 07:58:07 2017 +0530
# Node ID ab836b82e94bac18f61bde86c57ff5a57d76ece6
# Parent  980cc6b0ab20c38bd0d890e1b2701a3bbb73dfb3
py3: replace use of Request.has_data() with pycompat.request_has_data(request)

Request.has_data() is not present in Py3.5.

Patch

diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py
--- a/mercurial/keepalive.py
+++ b/mercurial/keepalive.py
@@ -91,6 +91,7 @@ 
 import threading
 
 from . import (
+    pycompat,
     util,
 )
 
@@ -309,7 +310,7 @@ 
             if n in headers:
                 skipheaders['skip_' + n.replace('-', '_')] = 1
         try:
-            if req.has_data():
+            if pycompat.request_has_data(req):
                 data = req.get_data()
                 h.putrequest(
                     req.get_method(), req.get_selector(), **skipheaders)
@@ -326,7 +327,7 @@ 
         for k, v in headers.items():
             h.putheader(k, v)
         h.endheaders()
-        if req.has_data():
+        if pycompat.request_has_data(req):
             h.send(data)
 
 class HTTPHandler(KeepAliveHandler, urlreq.httphandler):