]> granicus.if.org Git - python/commitdiff
Fix some mistakes- Issue3243 (r87399) Correcting the operator precendence
authorSenthil Kumaran <orsenthil@gmail.com>
Fri, 24 Dec 2010 04:03:59 +0000 (04:03 +0000)
committerSenthil Kumaran <orsenthil@gmail.com>
Fri, 24 Dec 2010 04:03:59 +0000 (04:03 +0000)
problem with Content-Length header and uncommenting the test.

Lib/http/client.py
Lib/test/test_urllib2.py
Lib/urllib/request.py

index 8d62aa57a7538b0ca38f0fd191c41d0f59666199..bb9fa9b0e7010d07bd20fc626e64d6bcfb9d4461 100644 (file)
@@ -775,7 +775,7 @@ class HTTPConnection:
                 for d in data:
                     self.sock.sendall(d)
             else:
-                raise TypeError("data should be byte-like object\
+                raise TypeError("data should be a bytes-like object\
                         or an iterable, got %r " % type(it))
 
     def _output(self, s):
index 1ce88af80e2d2f8de07c5430094524518a2c07ca..b8a609e4dcd276475dd02f3ae1899336bccb868c 100644 (file)
@@ -839,7 +839,6 @@ class HandlerTests(unittest.TestCase):
 
         # A file object
 
-        """
         file_obj = io.StringIO()
         file_obj.write("Something\nSomething\nSomething\n")
 
@@ -863,7 +862,6 @@ class HandlerTests(unittest.TestCase):
             req = Request("http://example.com/", iterable_array, headers)
             newreq = h.do_request_(req)
             self.assertEqual(int(newreq.get_header('Content-length')),16)
-        """
 
 
     def test_http_doubleslash(self):
index a88bc99d1d1ab72078a3c134f8ea65b5afd19852..4436105a07d0a7ad1af3b0d57d7f8dd2448802d8 100644 (file)
@@ -1062,7 +1062,7 @@ class AbstractHTTPHandler(BaseHandler):
                                 data))
                 else:
                     request.add_unredirected_header(
-                            'Content-length', '%d' % len(mv) * mv.itemsize)
+                            'Content-length', '%d' % (len(mv) * mv.itemsize))
 
         sel_host = host
         if request.has_proxy():