SF patch 568629 by Oren Tirosh: types made callable.

These built-in functions are replaced by their (now callable) type:

    slice()
    buffer()

and these types can also be called (but have no built-in named
function named after them)

    classobj (type name used to be "class")
    code
    function
    instance
    instancemethod (type name used to be "instance method")

The module "new" has been replaced with a small backward compatibility
placeholder in Python.

A large portion of the patch simply removes the new module from
various platform-specific build recipes.  The following binary Mac
project files still have references to it:

    Mac/Build/PythonCore.mcp
    Mac/Build/PythonStandSmall.mcp
    Mac/Build/PythonStandalone.mcp

[I've tweaked the code layout and the doc strings here and there, and
added a comment to types.py about StringTypes vs. basestring.  --Guido]
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index f96d0dd..4eac035 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -266,6 +266,52 @@
 	{NULL} /* Sentinel */
 };
 
+PyDoc_STRVAR(func_doc,
+"function(code, globals[, name[, argdefs]])\n\
+\n\
+Create a function object from a code object and a dictionary.\n\
+The optional name string overrides the name from the code object.\n\
+The optional argdefs tuple specifies the default argument values.");
+
+static PyObject *
+func_new(PyTypeObject* type, PyObject* args, PyObject* kw)
+{
+	PyObject *code;
+	PyObject *globals;
+	PyObject *name = Py_None;
+	PyObject *defaults = Py_None;
+	PyFunctionObject *newfunc;
+
+	if (!PyArg_ParseTuple(args, "O!O!|OO!:function",
+			      &PyCode_Type, &code,
+			      &PyDict_Type, &globals,
+			      &name,
+			      &PyTuple_Type, &defaults))
+		return NULL;
+	if (name != Py_None && !PyString_Check(name)) {
+		PyErr_SetString(PyExc_TypeError,
+				"arg 3 (name) must be None or string");
+		return NULL;
+	}
+
+	newfunc = (PyFunctionObject *)PyFunction_New(code, globals);
+	if (newfunc == NULL)
+		return NULL;
+
+	if (name != Py_None) {
+		Py_XINCREF(name);
+		Py_XDECREF(newfunc->func_name);
+		newfunc->func_name = name;
+	}
+	if (defaults != Py_None) {
+		Py_XINCREF(defaults);
+		Py_XDECREF(newfunc->func_defaults);
+		newfunc->func_defaults  = defaults;
+	}
+
+	return (PyObject *)newfunc;
+}
+
 static void
 func_dealloc(PyFunctionObject *op)
 {
@@ -415,7 +461,7 @@
 	PyObject_GenericSetAttr,		/* tp_setattro */
 	0,					/* tp_as_buffer */
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */
-	0,					/* tp_doc */
+	func_doc,				/* tp_doc */
 	(traverseproc)func_traverse,		/* tp_traverse */
 	0,					/* tp_clear */
 	0,					/* tp_richcompare */
@@ -430,6 +476,9 @@
 	func_descr_get,				/* tp_descr_get */
 	0,					/* tp_descr_set */
 	offsetof(PyFunctionObject, func_dict),	/* tp_dictoffset */
+	0,					/* tp_init */
+	0,					/* tp_alloc */
+	func_new,				/* tp_new */
 };