[Python-checkins] r87469 - in python/branches/py3k/Lib: http/client.py test/test_urllib2.py urllib/request.py

senthil.kumaran python-checkins at python.org
Fri Dec 24 05:03:59 CET 2010


Author: senthil.kumaran
Date: Fri Dec 24 05:03:59 2010
New Revision: 87469

Log:
Fix some mistakes- Issue3243 (r87399)  Correcting the operator precendence
problem with Content-Length header and uncommenting the test.



Modified:
   python/branches/py3k/Lib/http/client.py
   python/branches/py3k/Lib/test/test_urllib2.py
   python/branches/py3k/Lib/urllib/request.py

Modified: python/branches/py3k/Lib/http/client.py
==============================================================================
--- python/branches/py3k/Lib/http/client.py	(original)
+++ python/branches/py3k/Lib/http/client.py	Fri Dec 24 05:03:59 2010
@@ -775,7 +775,7 @@
                 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):

Modified: python/branches/py3k/Lib/test/test_urllib2.py
==============================================================================
--- python/branches/py3k/Lib/test/test_urllib2.py	(original)
+++ python/branches/py3k/Lib/test/test_urllib2.py	Fri Dec 24 05:03:59 2010
@@ -839,7 +839,6 @@
 
         # A file object
 
-        """
         file_obj = io.StringIO()
         file_obj.write("Something\nSomething\nSomething\n")
 
@@ -863,7 +862,6 @@
             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):

Modified: python/branches/py3k/Lib/urllib/request.py
==============================================================================
--- python/branches/py3k/Lib/urllib/request.py	(original)
+++ python/branches/py3k/Lib/urllib/request.py	Fri Dec 24 05:03:59 2010
@@ -1062,7 +1062,7 @@
                                 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():


More information about the Python-checkins mailing list