Fixes for shared 2.6 code that implements PEP 3101, advanced string
formatting.

Includes:
 - Modifying tests for basic types to use __format__ methods, instead
   of builtin "format".
 - Adding PyObject_Format.
 - General str/unicode cleanup discovered when backporting to 2.6.
 - Removing datetimemodule.c's time_format, since it was identical
   to date_format.

The files in Objects/stringlib that implement PEP 3101 (stringdefs.h,
unicodedefs.h, formatter.h, string_format.h) are identical in trunk
and py3k.  Any changes from here on should be made to trunk, and
changes will propogate to py3k).
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index b91a082..27c404f 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -3210,21 +3210,6 @@
 	return result;
 }
 
-static PyObject *
-time_format(PyDateTime_Time *self, PyObject *args)
-{
-	PyObject *format;
-
-	if (!PyArg_ParseTuple(args, "U:__format__", &format))
-		return NULL;
-
-	/* if the format is zero length, return str(self) */
-	if (PyUnicode_GetSize(format) == 0)
-                return PyObject_Str((PyObject *)self);
-
-        return PyObject_CallMethod((PyObject *)self, "strftime", "O", format);
-}
-
 /*
  * Miscellaneous methods.
  */
@@ -3412,7 +3397,7 @@
 	{"strftime",   	(PyCFunction)time_strftime,	METH_VARARGS | METH_KEYWORDS,
 	 PyDoc_STR("format -> strftime() style string.")},
 
-	{"__format__", 	(PyCFunction)time_format,	METH_VARARGS,
+	{"__format__", 	(PyCFunction)date_format,	METH_VARARGS,
 	 PyDoc_STR("Formats self with strftime.")},
 
 	{"utcoffset",	(PyCFunction)time_utcoffset,	METH_NOARGS,