diff -r 7af576e3cb0c Lib/http/client.py --- a/Lib/http/client.py Mon Aug 01 17:31:12 2011 +0200 +++ b/Lib/http/client.py Mon Aug 01 11:02:23 2011 -0700 @@ -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 -r 7af576e3cb0c Lib/test/test_httplib.py --- a/Lib/test/test_httplib.py Mon Aug 01 17:31:12 2011 +0200 +++ b/Lib/test/test_httplib.py Mon Aug 01 11:02:23 2011 -0700 @@ -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'