diff Python/errors.c @ 30683:3b59fa5d25b1 legacy-trunk

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)
author Raymond Hettinger <python@rcn.com>
date Sun, 12 Oct 2003 19:09:37 +0000
parents 72cbc41ccc2f
children 74747f62f286
line wrap: on
line diff
--- a/Python/errors.c	Sun Oct 12 18:24:34 2003 +0000
+++ b/Python/errors.c	Sun Oct 12 19:09:37 2003 +0000
@@ -159,13 +159,13 @@
 			PyObject *args, *res;
 
 			if (value == Py_None)
-				args = Py_BuildValue("()");
+				args = PyTuple_New(0);
 			else if (PyTuple_Check(value)) {
 				Py_INCREF(value);
 				args = value;
 			}
 			else
-				args = Py_BuildValue("(O)", value);
+				args = PyTuple_Pack(1, value);
 
 			if (args == NULL)
 				goto finally;
@@ -560,7 +560,7 @@
 	classname = PyString_FromString(dot+1);
 	if (classname == NULL)
 		goto failure;
-	bases = Py_BuildValue("(O)", base);
+	bases = PyTuple_Pack(1, base);
 	if (bases == NULL)
 		goto failure;
 	result = PyClass_New(bases, dict, classname);