Merged revisions 67245,67277,67289,67295,67301-67303,67307,67330,67332,67336,67355,67359,67362,67364,67367-67368,67370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67245 | benjamin.peterson | 2008-11-17 23:05:19 +0100 (Mon, 17 Nov 2008) | 1 line

  improve __hash__ docs
........
  r67277 | skip.montanaro | 2008-11-19 04:35:41 +0100 (Wed, 19 Nov 2008) | 1 line

  patch from issue 1108
........
  r67289 | brett.cannon | 2008-11-19 21:29:39 +0100 (Wed, 19 Nov 2008) | 2 lines

  Ignore .pyc and .pyo files.
........
  r67295 | benjamin.peterson | 2008-11-20 05:05:12 +0100 (Thu, 20 Nov 2008) | 1 line

  move useful sys.settrace information to the function's documentation from the debugger
........
  r67301 | benjamin.peterson | 2008-11-20 22:25:31 +0100 (Thu, 20 Nov 2008) | 1 line

  fix indentation and a sphinx warning
........
  r67302 | benjamin.peterson | 2008-11-20 22:44:23 +0100 (Thu, 20 Nov 2008) | 1 line

  oops! didn't mean to disable that test
........
  r67303 | benjamin.peterson | 2008-11-20 23:06:22 +0100 (Thu, 20 Nov 2008) | 1 line

  backport r67300
........
  r67307 | amaury.forgeotdarc | 2008-11-21 00:34:31 +0100 (Fri, 21 Nov 2008) | 9 lines

  Fixed issue #4233.
  Changed semantic of _fileio.FileIO's close()  method on file objects with closefd=False.
  The file descriptor is still kept open but the file object behaves like a closed file.
  The FileIO  object also got a new readonly attribute closefd.

  Approved by Barry

  Backport of r67106 from the py3k branch
........
  r67330 | georg.brandl | 2008-11-22 09:34:14 +0100 (Sat, 22 Nov 2008) | 2 lines

  #4364: fix attribute name on ctypes object.
........
  r67332 | georg.brandl | 2008-11-22 09:45:33 +0100 (Sat, 22 Nov 2008) | 2 lines

  Fix typo.
........
  r67336 | georg.brandl | 2008-11-22 11:08:50 +0100 (Sat, 22 Nov 2008) | 2 lines

  Fix error about "-*-" being mandatory in coding cookies.
........
  r67355 | georg.brandl | 2008-11-23 20:17:25 +0100 (Sun, 23 Nov 2008) | 2 lines

  #4392: fix parameter name.
........
  r67359 | georg.brandl | 2008-11-23 22:57:30 +0100 (Sun, 23 Nov 2008) | 2 lines

  #4399: fix typo.
........
  r67362 | gregory.p.smith | 2008-11-24 01:41:43 +0100 (Mon, 24 Nov 2008) | 2 lines

  Document PY_SSIZE_T_CLEAN for PyArg_ParseTuple.
........
  r67364 | benjamin.peterson | 2008-11-24 02:16:29 +0100 (Mon, 24 Nov 2008) | 2 lines

  replace reference to debugger-hooks
........
  r67367 | georg.brandl | 2008-11-24 17:16:07 +0100 (Mon, 24 Nov 2008) | 2 lines

  Fix typo.
........
  r67368 | georg.brandl | 2008-11-24 20:56:47 +0100 (Mon, 24 Nov 2008) | 2 lines

  #4404: make clear what "path" is.
........
  r67370 | jeremy.hylton | 2008-11-24 23:00:29 +0100 (Mon, 24 Nov 2008) | 8 lines

  Add unittests that verify documented behavior of public methods in Transport
  class.

  These methods can be overridden.  The tests verify that the overridden
  methods are called, and that changes to the connection have a visible
  effect on the request.
........
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
index bbdb93e..c9294b1 100644
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -9,6 +9,7 @@
 import mimetools
 import httplib
 import socket
+import StringIO
 import os
 from test import test_support
 
@@ -639,9 +640,93 @@
         os.remove("xmldata.txt")
         os.remove(test_support.TESTFN)
 
+class FakeSocket:
+
+    def __init__(self):
+        self.data = StringIO.StringIO()
+
+    def send(self, buf):
+        self.data.write(buf)
+        return len(buf)
+
+    def sendall(self, buf):
+        self.data.write(buf)
+
+    def getvalue(self):
+        return self.data.getvalue()
+
+    def makefile(self, x, y):
+        raise RuntimeError
+
+class FakeTransport(xmlrpclib.Transport):
+    """A Transport instance that records instead of sending a request.
+
+    This class replaces the actual socket used by httplib with a
+    FakeSocket object that records the request.  It doesn't provide a
+    response.
+    """
+
+    def make_connection(self, host):
+        conn = xmlrpclib.Transport.make_connection(self, host)
+        conn._conn.sock = self.fake_socket = FakeSocket()
+        return conn
+
+class TransportSubclassTestCase(unittest.TestCase):
+
+    def issue_request(self, transport_class):
+        """Return an HTTP request made via transport_class."""
+        transport = transport_class()
+        proxy = xmlrpclib.ServerProxy("http://example.com/",
+                                      transport=transport)
+        try:
+            proxy.pow(6, 8)
+        except RuntimeError:
+            return transport.fake_socket.getvalue()
+        return None
+
+    def test_custom_user_agent(self):
+        class TestTransport(FakeTransport):
+
+            def send_user_agent(self, conn):
+                xmlrpclib.Transport.send_user_agent(self, conn)
+                conn.putheader("X-Test", "test_custom_user_agent")
+
+        req = self.issue_request(TestTransport)
+        self.assert_("X-Test: test_custom_user_agent\r\n" in req)
+
+    def test_send_host(self):
+        class TestTransport(FakeTransport):
+
+            def send_host(self, conn, host):
+                xmlrpclib.Transport.send_host(self, conn, host)
+                conn.putheader("X-Test", "test_send_host")
+
+        req = self.issue_request(TestTransport)
+        self.assert_("X-Test: test_send_host\r\n" in req)
+
+    def test_send_request(self):
+        class TestTransport(FakeTransport):
+
+            def send_request(self, conn, url, body):
+                xmlrpclib.Transport.send_request(self, conn, url, body)
+                conn.putheader("X-Test", "test_send_request")
+
+        req = self.issue_request(TestTransport)
+        self.assert_("X-Test: test_send_request\r\n" in req)
+
+    def test_send_content(self):
+        class TestTransport(FakeTransport):
+
+            def send_content(self, conn, body):
+                conn.putheader("X-Test", "test_send_content")
+                xmlrpclib.Transport.send_content(self, conn, body)
+
+        req = self.issue_request(TestTransport)
+        self.assert_("X-Test: test_send_content\r\n" in req)
+
 def test_main():
     xmlrpc_tests = [XMLRPCTestCase, HelperTestCase, DateTimeTestCase,
-         BinaryTestCase, FaultTestCase]
+         BinaryTestCase, FaultTestCase, TransportSubclassTestCase]
 
     # The test cases against a SimpleXMLRPCServer raise a socket error
     # 10035 (WSAEWOULDBLOCK) in the server thread handle_request call when