Simplify and speedup uses of Py_BuildValue():

* Py_BuildValue("(OOO)",a,b,c)  -->  PyTuple_Pack(3,a,b,c)
* Py_BuildValue("()",a)         -->  PyTuple_New(0)
* Py_BuildValue("O", a)         -->  Py_INCREF(a)
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 0df249d..b0e1934 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -750,7 +750,7 @@
 		if (!PyErr_ExceptionMatches(PyExc_AttributeError))
 			return NULL;
 		PyErr_Clear();
-		args = Py_BuildValue("(OO)", inst, name);
+		args = PyTuple_Pack(2, inst, name);
 		if (args == NULL)
 			return NULL;
 		res = PyEval_CallObject(func, args);
@@ -847,9 +847,9 @@
 	if (func == NULL)
 		return instance_setattr1(inst, name, v);
 	if (v == NULL)
-		args = Py_BuildValue("(OO)", inst, name);
+		args = PyTuple_Pack(2, inst, name);
 	else
-		args = Py_BuildValue("(OOO)", inst, name, v);
+		args = PyTuple_Pack(3, inst, name, v);
 	if (args == NULL)
 		return -1;
 	res = PyEval_CallObject(func, args);
@@ -1038,7 +1038,7 @@
 	func = instance_getattr(inst, getitemstr);
 	if (func == NULL)
 		return NULL;
-	arg = Py_BuildValue("(O)", key);
+	arg = PyTuple_Pack(1, key);
 	if (arg == NULL) {
 		Py_DECREF(func);
 		return NULL;
@@ -1069,9 +1069,9 @@
 	if (func == NULL)
 		return -1;
 	if (value == NULL)
-		arg = Py_BuildValue("(O)", key);
+		arg = PyTuple_Pack(1, key);
 	else
-		arg = Py_BuildValue("(OO)", key, value);
+		arg = PyTuple_Pack(2, key, value);
 	if (arg == NULL) {
 		Py_DECREF(func);
 		return -1;
@@ -1281,7 +1281,7 @@
 	if (func) {
 		PyObject *res;
 		int ret;
-		PyObject *arg = Py_BuildValue("(O)", member);
+		PyObject *arg = PyTuple_Pack(1, member);
 		if(arg == NULL) {
 			Py_DECREF(func);
 			return -1;
@@ -1346,7 +1346,7 @@
 		Py_INCREF(Py_NotImplemented);
 		return Py_NotImplemented;
 	}
-	args = Py_BuildValue("(O)", w);
+	args = PyTuple_Pack(1, w);
 	if (args == NULL) {
 		Py_DECREF(func);
 		return NULL;
@@ -1389,7 +1389,7 @@
 		return generic_binary_op(v, w, opname);
 	}
 
-	args = Py_BuildValue("(O)", w);
+	args = PyTuple_Pack(1, w);
 	if (args == NULL) {
 		Py_DECREF(coercefunc);
 		return NULL;
@@ -1474,7 +1474,7 @@
 		return 1;
 	}
 	/* Has __coerce__ method: call it */
-	args = Py_BuildValue("(O)", w);
+	args = PyTuple_Pack(1, w);
 	if (args == NULL) {
 		return -1;
 	}
@@ -1587,7 +1587,7 @@
 		return 2;
 	}
 
-	args = Py_BuildValue("(O)", w);
+	args = PyTuple_Pack(1, w);
 	if (args == NULL) {
 		Py_DECREF(cmp_func);
 		return -2;
@@ -1747,7 +1747,7 @@
 		func = PyObject_GetAttrString(v, "__pow__");
 		if (func == NULL)
 			return NULL;
-		args = Py_BuildValue("(OO)", w, z);
+		args = PyTuple_Pack(2, w, z);
 		if (args == NULL) {
 			Py_DECREF(func);
 			return NULL;
@@ -1786,7 +1786,7 @@
 			PyErr_Clear();
 			return instance_pow(v, w, z);
 		}
-		args = Py_BuildValue("(OO)", w, z);
+		args = PyTuple_Pack(2, w, z);
 		if (args == NULL) {
 			Py_DECREF(func);
 			return NULL;
@@ -1859,7 +1859,7 @@
 		return res;
 	}
 
-	args = Py_BuildValue("(O)", w);
+	args = PyTuple_Pack(1, w);
 	if (args == NULL) {
 		Py_DECREF(method);
 		return NULL;
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index 96fa33d..c29d48d 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -439,7 +439,7 @@
 	mod = c_diff(v->cval, c_prod(w->cval, div));
 	d = PyComplex_FromCComplex(div);
 	m = PyComplex_FromCComplex(mod);
-	z = Py_BuildValue("(OO)", d, m);
+	z = PyTuple_Pack(2, d, m);
 	Py_XDECREF(d);
 	Py_XDECREF(m);
 	return z;
@@ -865,7 +865,7 @@
 	if (f == NULL)
 		PyErr_Clear();
 	else {
-		PyObject *args = Py_BuildValue("()");
+		PyObject *args = PyTuple_New(0);
 		if (args == NULL)
 			return NULL;
 		r = PyEval_CallObject(f, args);
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index d7c9da5..6f90fb9 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -1227,7 +1227,7 @@
 		if (reader == NULL)
 			return NULL;
 		if (n <= 0)
-			args = Py_BuildValue("()");
+			args = PyTuple_New(0);
 		else
 			args = Py_BuildValue("(i)", n);
 		if (args == NULL) {
@@ -2104,7 +2104,7 @@
 		Py_DECREF(writer);
 		return -1;
 	}
-	args = Py_BuildValue("(O)", value);
+	args = PyTuple_Pack(1, value);
 	if (args == NULL) {
 		Py_DECREF(value);
 		Py_DECREF(writer);
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index bb498e4..dcb43e5 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -163,7 +163,7 @@
 		}
 		else {
 			PyObject* tuple;
-			tuple = Py_BuildValue("OO", subclass, old_mro);
+			tuple = PyTuple_Pack(2, subclass, old_mro);
 			Py_DECREF(old_mro);
 			if (!tuple)
 				return -1;
@@ -258,8 +258,8 @@
 		for (i = 0; i < PyList_Size(temp); i++) {
 			PyTypeObject* cls;
 			PyObject* mro;
-			PyArg_ParseTuple(PyList_GET_ITEM(temp, i),
-					 "OO", &cls, &mro);
+			PyArg_UnpackTuple(PyList_GET_ITEM(temp, i),
+					 "", 2, 2, &cls, &mro);
 			Py_DECREF(cls->tp_mro);
 			cls->tp_mro = mro;
 			Py_INCREF(cls->tp_mro);
@@ -1606,7 +1606,7 @@
 
 	/* Adjust for empty tuple bases */
 	if (nbases == 0) {
-		bases = Py_BuildValue("(O)", &PyBaseObject_Type);
+		bases = PyTuple_Pack(1, &PyBaseObject_Type);
 		if (bases == NULL)
 			return NULL;
 		nbases = 1;
@@ -1650,7 +1650,7 @@
 
 		/* Make it into a tuple */
 		if (PyString_Check(slots))
-			slots = Py_BuildValue("(O)", slots);
+			slots = PyTuple_Pack(1, slots);
 		else
 			slots = PySequence_Tuple(slots);
 		if (slots == NULL) {
@@ -2644,8 +2644,7 @@
 		PyTuple_SET_ITEM(args2, i+1, v);
 	}
 
-	res = Py_BuildValue("(OOOOO)",
-			    newobj, args2, state, listitems, dictitems);
+	res = PyTuple_Pack(5, newobj, args2, state, listitems, dictitems);
 
   end:
 	Py_XDECREF(cls);
@@ -3142,7 +3141,7 @@
 		if (base == NULL)
 			bases = PyTuple_New(0);
 		else
-			bases = Py_BuildValue("(O)", base);
+			bases = PyTuple_Pack(1, base);
 		if (bases == NULL)
 			goto error;
 		type->tp_bases = bases;
@@ -4127,7 +4126,7 @@
 
 	func = lookup_maybe(self, "__contains__", &contains_str);
 	if (func != NULL) {
-		args = Py_BuildValue("(O)", value);
+		args = PyTuple_Pack(1, value);
 		if (args == NULL)
 			res = NULL;
 		else {
@@ -4342,7 +4341,7 @@
 		PyErr_Clear();
 	}
 	else {
-		args = Py_BuildValue("(O)", other);
+		args = PyTuple_Pack(1, other);
 		if (args == NULL)
 			res = NULL;
 		else {
@@ -4571,7 +4570,7 @@
 		Py_INCREF(Py_NotImplemented);
 		return Py_NotImplemented;
 	}
-	args = Py_BuildValue("(O)", other);
+	args = PyTuple_Pack(1, other);
 	if (args == NULL)
 		res = NULL;
 	else {