Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1e991f2

Browse files
committed
Fix some mistakes- Issue3243 (r87399) Correcting the operator precendence
problem with Content-Length header and uncommenting the test.
1 parent c44befb commit 1e991f2

3 files changed

Lines changed: 2 additions & 4 deletions

File tree

Lib/http/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ def send(self, data):
775775
for d in data:
776776
self.sock.sendall(d)
777777
else:
778-
raise TypeError("data should be byte-like object\
778+
raise TypeError("data should be a bytes-like object\
779779
or an iterable, got %r " % type(it))
780780

781781
def _output(self, s):

Lib/test/test_urllib2.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,6 @@ def iterable_body():
839839

840840
# A file object
841841

842-
"""
843842
file_obj = io.StringIO()
844843
file_obj.write("Something\nSomething\nSomething\n")
845844

@@ -863,7 +862,6 @@ def iterable_body():
863862
req = Request("http://example.com/", iterable_array, headers)
864863
newreq = h.do_request_(req)
865864
self.assertEqual(int(newreq.get_header('Content-length')),16)
866-
"""
867865

868866

869867
def test_http_doubleslash(self):

Lib/urllib/request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ def do_request_(self, request):
10621062
data))
10631063
else:
10641064
request.add_unredirected_header(
1065-
'Content-length', '%d' % len(mv) * mv.itemsize)
1065+
'Content-length', '%d' % (len(mv) * mv.itemsize))
10661066

10671067
sel_host = host
10681068
if request.has_proxy():

0 commit comments

Comments
 (0)