[Python-checkins] cpython (3.2): Fix closes Issue12676 - Invalid identifier used in TypeError message in
senthil.kumaran
python-checkins at python.org
Tue Aug 2 12:33:55 CEST 2011
http://hg.python.org/cpython/rev/1013c9fbd83c
changeset: 71688:1013c9fbd83c
branch: 3.2
parent: 71683:68b5f87566fb
user: Senthil Kumaran <senthil at uthcode.com>
date: Tue Aug 02 18:33:41 2011 +0800
summary:
Fix closes Issue12676 - Invalid identifier used in TypeError message in http.client.
Reported by Popa Claudiu and Patch by Santoso Wijaya.
files:
Lib/http/client.py | 2 +-
Lib/test/test_httplib.py | 7 +++++++
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/Lib/http/client.py b/Lib/http/client.py
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -778,7 +778,7 @@
self.sock.sendall(d)
else:
raise TypeError("data should be a bytes-like object\
- or an iterable, got %r " % type(it))
+ or an iterable, got %r " % type(data))
def _output(self, s):
"""Add a line of output to the current request buffer.
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -246,6 +246,13 @@
conn.request('GET', '/foo', body(), {'Content-Length': '11'})
self.assertEqual(sock.data, expected)
+ def test_send_type_error(self):
+ # See: Issue #12676
+ conn = client.HTTPConnection('example.com')
+ conn.sock = FakeSocket('')
+ with self.assertRaises(TypeError):
+ conn.request('POST', 'test', conn)
+
def test_chunked(self):
chunked_start = (
'HTTP/1.1 200 OK\r\n'
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list